Jump to content

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

Timeline Length

Recommended Posts

Hi there,


Is there a basic way to calculate the length of a TimelineMax animation?


I do alot of banner work with Greensock and publishers have strict 15sec limits.


I can't find an example anywhere.





Link to comment
Share on other sites

Absolutely. That's what the duration() is for. Or totalDuration() if you want to include all the repeats and repeatDelays. 

var tl = new TimelineMax();
tl.to(...).to(....); //add stuff

console.log("duration is: " + tl.duration());

If you want it to stop after 15 seconds, you have a lot of options...



TweenLite.delayedCall(15, function() {

or if you want to be fancy and gradually slow it down after 15 seconds (instead of an abrupt stop):

TweenLite.delayedCall(15, function() {
    TweenLite.to(tl, 1, {timeScale:0, onComplete:function() { tl.pause(); }});

Does that help?

  • Like 7
Link to comment
Share on other sites

This absolutely helps! Thank you so much. I love Greensock even more. :)

  • Like 1
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.