Creating a Simple Sequence
Master animation sequencing with GreenSock TweenLite
Core GreenSock Concepts
TweenLite.from() Method
Define start values instead of end values for animations. Elements are positioned at their final state in CSS, then animated from specified starting positions.
Relative vs Absolute Values
Use += or -= prefixes for relative positioning. This allows animations to work regardless of the element's current CSS position values.
Delay-Based Sequencing
Create animation sequences by calculating delays based on previous tween durations. Simple but has limitations for complex animations.
Animation Sequence Build Process
Set Up HTML Structure
Create DOM elements with proper IDs and position them with CSS in their final animated state
Animate from Start Values
Use TweenLite.from() to define where animations begin, letting CSS handle end positions
Calculate Sequence Delays
Time each animation to start when the previous one completes using duration plus delay calculations
Jive Factory Animation Sequence
Header Image Fade In
Lower Manhattan skyline fades in from transparent
Logo Animation
Jive Factory logo rotates and scales in from left with Back ease
Address Slide In
Restaurant address moves in from right while logo is still animating
Content Area Rise
Main content section moves into place from bottom
Preview start.html in your web browser.
All four elements appear in their final positions immediately. This is the correct approach for professional animation workflow: always establish your final layout with proper CSS before adding animation logic. This methodology ensures accessibility compliance, provides fallback behavior for users who prefer reduced motion, and makes debugging significantly easier when animations become complex.
Element Selection Methods
| Feature | document.getElementById() | CSS Selector String |
|---|---|---|
| Syntax | document.getElementById('bg') | #bg |
| Flexibility | Single element only | Multiple selection patterns |
| CSS-like Targeting | No | Yes (h2, .feature, h2.feature) |
TweenLite.from('#bg', 1, {opacity:0, delay:0.5});
In animated page builds, lay out all HTML elements with proper CSS in their final positions before coding animations. This ensures the page resolves correctly and provides clear end targets for your tweens.
Absolute vs Relative Value Animation
| Feature | Absolute Values | Relative Values |
|---|---|---|
| Syntax Example | left: 200 | left: '+=200' |
| Final Position | Exactly 200px from left | Current position + 200px |
| CSS Independence | Requires knowing exact values | Works with any starting position |
| Maintenance | Breaks if CSS changes | Adapts to CSS changes |
Delay-Based Animation Sequencing
Changing the background delay from 0.5 seconds to 4 seconds demonstrates how fragile delay-based sequences are. A single timing change requires recalculating the entire animation flow.
Key Takeaways
