Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
cbg

Start timeline only after an event has happened

Recommended Posts

Hello, I'm producing an ad template for DoubleClick Studio using polite loading, this is my first time using this. The polite loading appears to work correctly but my GSAP animation plays straight away, how can I have my GSAP animation only begin after it has loaded like the other elements?

 

You'll see on my CodePen that the ball moves before the 'loading' disappears. I know I need to put the animation code within the politeInit function, but when I do this, GSAP breaks completely and it never plays.

 

Thanks

JavaScript novice

See the Pen bQpWja by cbg (@cbg) on CodePen

Link to comment
Share on other sites

Try using Google's polite loading template at: https://support.google.com/richmedia/answer/2672514?hl=en

You're also loading a number plugins that are redundant or you don't need. jQuery is not needed at all for a simple animation like this and TweenMax already includes TimelineMax, CssPlugin and easePack. You don't need to explicitly run them as you have in your HTML.
 

It also looks like you're trying to use JavaScript to create a second CSS (polite.css) file. You should not have to do this because you can initialize everything you need in your global.css. While it's technically possible to load a second CSS file, I believe it's poor programming practice to do that especially in this case where you have very simple animation.

Remember that efficiency should be your ultimate goal when building banners. As a result, you should only load plugins, scripts, css files, etc that you need.

 

You can also contact Double Click directly through chat or email and can even send them your code. They will often write big sections of code for you.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×