Jump to content
Search Community

Is there a way to play an animation to a progress point?

padders test
Moderator Tag

Go to solution Solved by Carl,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I can see a way of setting an animation at a specific progress (50% of the way through in the example below)

AnimationTimeLine.progress(0.5);

I was wondering if there was a way to make an animation play to a specific point as opposed to just instantly setting it there? Something like...

AnimationTimeLine.playTo(0.5);

If the progress of the animation was 0, it would then play the animation from the start, to 50% of the way through. If it was at the end, it would play it in reverse to 50% of the way through.

 

Is that possible? I've had a read of the docs but couldn't find anything (It's quite likely I'm being blind...). 

Link to comment
Share on other sites

  • Solution

TimelineMax has a [docs id=js.TimelineMax.tweenTo()] method that lets you tween to any time or label

myTimeline.tweenTo(5) // 5 seconds
myTimeline.tweenTo("middle") // a label named middle (if you have one)

However, you can actually tween the progress of any tween or timeline with

var tween = TweenLite.to(element, 1, {x:500, paused:true});

TweenLite.to(tween, 0.5, {progress:0.5});
  • Like 5
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.
×
×
  • Create New...