Jump to content
GreenSock

folktrash

Ways to approach changing durations.

Recommended Posts

Hi!

 

I'm curious if there's a good way to manage changing durations. I don't have code snippet handy atm, but the situation is this: We have a series of animations/scene. There's the intro timeline, the waiting timeline, and the outro timeline. It's a loader scene.

 

The intro and outro are their own var'd new TimeLineMax(), with a series of tweens. These animations have static duration, e.g. the intro takes one second, and the outro takes 2 or whatnot.

 

The waiting timeline is a repeating series of .to()'s saved into a var'd timeline. The total time is variable based on bandwidth and filesize. I'd like to alter the duration the containing tweens (independently if possible), as the total wait time increases; Speeding up the repeating effect (reducing the duration) the longer we're waiting.

 

I can navigate an onComplete that checks some bool and restart()'s that timeline to "get" a repeating animation without using repeat explicitly. Related: is there an API for timeline.repeateUntilFurtherNotice()? I didn't see one (https://www.greensock.com/asdocs/com/greensock/TimelineMax.html#methodSummary).

 

Either way - what is a good approach for modding the duration of tweens inside a timeline when the total duration is variable/unknown?

Link to comment
Share on other sites

Hi folktrash :)

 

you can use .duration() too , adjusts the timeline's timeScale to fit it within the specified duration.

 

pls check this out : 

See the Pen rOKpBb by MAW (@MAW) on CodePen

  • Like 3
Link to comment
Share on other sites

Just to add my two bits:

 

Here are the link to the 2 methods Blake and Diaco advised above from the GSAP Docs.

 

GSAP Docs:

 

http://greensock.com/docs/#/HTML5/GSAP/

 

:)

  • Like 1
Link to comment
Share on other sites

I never noticed this, but duration just changes the timeScale. It makes sense. I just never thought about it. So setting the timeScale to 1 will revert it back to its original speed if it was changed with duration.

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.
×