GreenSock: Animating an HTML5 Ad (Google Banner Ads)
Master Professional HTML5 Banner Animation with GreenSock
Core Animation Concepts
Timeline Management
Create sophisticated multi-scene animations using GreenSock's timeline system for precise control and sequencing.
Panel-Based Animation
Structure complex animations as distinct panels or scenes, making development and maintenance more manageable.
Google Ads Integration
Optimize file sizes by leveraging Google's hosted GSAP library, keeping your ad within size limits.
Animation Development Workflow
Structure Planning
Layout all panels vertically like a storyboard before creating any animations
Timeline Creation
Build a master timeline to control the sequence and timing of all animations
Panel Animation
Animate each panel individually with proper positioning and transitions
Optimization
Add labels for testing and implement overflow hiding for clean presentation
Google Ads have a file size limit of 150KB for all assets. Using Google's hosted GSAP library doesn't count toward this limit, making it essential for banner ads.
Google Hosted GSAP
If your GSAP animations aren't working, disable ad blockers in your browser. They can block the GSAP library from Google's servers.
Save and reload the page to see the text slide animation in action.
The smooth upward slide creates anticipation and reveals the text with purpose. This type of directional animation guides the viewer's eye and creates a sense of progression through the advertising narrative.
Complete the second panel's lifecycle by animating the text's exit after an appropriate viewing duration:
.from('#panel2-text', {duration:0.2, yPercent:100}, '+=0.5')
.to('#panel2-text', {duration:0.2, yPercent:100}, '+=2')
This symmetrical exit—sliding back down to the same position it entered from—creates visual continuity and prepares the stage for the final panel's entrance.
Save and reload the page to observe the complete second panel sequence.
The second panel now demonstrates professional animation choreography: dynamic entrance, content reveal, adequate viewing time, and clean exit. Note that any slight visual overflow during the scaling transition will be addressed in our final optimization step.
With two panels successfully animated, we'll now implement the crucial third panel that delivers the call-to-action and completes our advertising narrative.
GSAP Position Properties
| Feature | X & Y Properties | XPercent & YPercent |
|---|---|---|
| Units | Fixed pixels | Percentage of element size |
| Responsiveness | Static positioning | Adaptive to element dimensions |
| Use Case | Precise pixel control | Relative positioning and responsive design |
| Calculation | Manual pixel calculation | Automatic based on element size |
Enhance the visual composition by repositioning the burger image to complement the information panel overlay:
.from('#info', {duration:0.5, yPercent:100})
.to('#panel2', {duration:0.5, y:-65})
tl.seek('final');Save and reload the page to evaluate the improved composition.
The burger repositioning creates better visual balance, but the sequential animation feels disconnected. Professional banner ads require seamless coordination between multiple elements to maintain viewer engagement and create polished visual experiences.
Synchronize the burger repositioning with the information panel's entrance using GSAP's relative positioning syntax:
.to('#panel2', {duration:0.5, y:-65}, '<')
The '<' parameter instructs GSAP to start this tween simultaneously with the previous tween's start time, creating perfectly synchronized motion.
Save and reload the page to observe the coordinated animation.
Excellent! The simultaneous movement creates a cohesive transition that feels intentional and professional. Now we'll add the staggered text reveals that build engagement through progressive disclosure.
Implement a sophisticated staggered animation for the list items that creates visual hierarchy and reading flow:
.to('#panel2', {duration:0.5, y:-65}, '<')
.from('#info li', {duration:0.3, opacity:0, x:50, stagger:0.1}, '+=0.2')
tl.seek('final');Let's analyze the parameters that create this polished stagger effect:
- Each #info li element animates for 0.3 seconds, providing smooth but efficient transitions.
- Elements fade in from opacity: 0 and slide from x: 50, creating a right-to-left entrance that guides reading flow.
- The stagger: 0.1 creates 0.1-second intervals between each element's start time, preventing visual chaos while maintaining dynamic energy.
- The '+=0.2' position parameter adds a brief pause after the panel entrance, allowing viewers to register the new context before text appears.
Save and reload the page to observe the staggered text animation.
The sequential text reveals create professional visual hierarchy and ensure readability—crucial factors in effective call-to-action design.
Complete the sequence with a compelling call-to-action button animation that demands attention without being aggressive:
.from('#info li', {duration:0.3, opacity:0, x:50, stagger:0.1}, '+=0.2')
.from('#order-now', {duration:0.5, scale:0, opacity:0, ease:'back.out'})
The "back.out" easing on the button creates a subtle bounce that suggests interactivity—a psychological trigger that increases click-through rates in digital advertising.
Save and reload the page to see the complete third panel sequence.
Perfect! The final panel demonstrates professional conversion-focused design principles through its carefully orchestrated reveal sequence.
Now let's experience the complete banner animation from beginning to end by removing our development shortcut:
tl.seek('final');Save and reload the page to watch the complete animation sequence.
Observe how the three-panel narrative creates engagement, builds desire, and culminates in a clear call-to-action. This structure exemplifies effective digital advertising storytelling that respects user attention while achieving business objectives.
Our animation sequence is functionally complete, but professional banner development requires attention to visual refinement details that enhance the overall user experience.
Key Takeaways
