Jump to content

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

Set the length of a timeline for timelinemax?

Recommended Posts

I need to have animations that stay in sync with a video that is playing. Can i set the duration of my TimelineMax animation to be the length of the video? (Then simply set delays in secs on each animation when i want it to occur?) I can achieve this effect by adding a few dummy tweens at the end of my animations but this seems kinda hackish.

Link to comment
Share on other sites

The duration and totalDuration properties will always reflect the TimelineLite/Max's contents (the tweens it contains). So you cannot, for example, have a TimelineLite with a duration of 10 seconds even though it only contains 1 tween that's 2 seconds long. Well, unless that tween's timeScale is 5 :) But you can technically set a TimelineLite/Max's duration or totalDuration property, but doing so will simply adjust its timeScale so that it takes that long to run. For example, if a TimelineLite's totalDuration is 2 and I manually set its totalDuration to 10, it will just force its timeScale to be 5 (its totalDuration will still report as being 2).

Link to comment
Share on other sites

Gotcha. Ok, to achieve what I want I may just have an 'empty' tween at the end or something to make it as long as the video. (Tween something's alpha property to 0 even if it is invisible...)

Link to comment
Share on other sites

  • 4 years later...

I have also resorted the the hack above, does anyone know of a prettier solution? I am using it with scrollMagic and don't want the pin to end quite so soon

Link to comment
Share on other sites

The code below will give your timeline a duration of 25 seconds.

tl.to(obj, 1, {x:400})
  .set({}, {}, 25); //place empty set at time of 25 seconds
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.