Jump to content
Search Community

Spool to a Part in a Timeline

sjerrentrup test
Moderator Tag

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

Is it possible to spool to a certain part in a timeline and play forward (or backward) from there?  Like setting a flag and on init() calling a flag on that part of the animation (e.g. init("thirdPart"))?  I ask this, because I need to debug and right now, I have to sit through the full animation to check the end.  Would save a lot of time.

 

Thanks,

 

-Stefan

 

 

See the Pen xGQaOE by hyperbola (@hyperbola) on CodePen

Link to comment
Share on other sites

Hey sjerrentrup,

 

I think you may also be asking about seek. Once you add the label as Diaco has suggested you can them simply jump to it by using tl.seek("yourLabel")or you can also jump by time: tl.seek(2) will jump to 2 seconds.  :-)

  • Like 1
Link to comment
Share on other sites

All the answers above are great and work fine.

 

Definitely check out the docs and see that play(), reverse() and resume() all take a from parameter

 

.play( from:*, suppressEvents:Boolean ) : *

Begins playing forward, optionally from a specific time (by default playback begins from wherever the playhead currently is).

 

from : *

(default = null) — The time (or label for TimelineLite/TimelineMax instances) from which the animation should begin playing (if none is defined, it will begin playing from wherever the playhead currently is).

 

//begins playing from wherever the playhead currently is:
myAnimation.play();
//begins playing from exactly 2-seconds into the animation:
myAnimation.play(2);
//reverse from the "news" label
myAnimation.reverse("news");

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

 

 

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