Jump to content
Search Community

Repeat part of timeline?

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

HI jesper.landberg :)

 

Labels are your friend for something like that. Add a label at the beginning and end of the part you want to play and use the tweenFromTo() method to play between them. Something like this:

tl.tweenFromTo("startTest", "endTest");

See the Pen EKZjpo by PointC (@PointC) on CodePen

 

More info about tweenFromTo()

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

 

Hopefully that helps.

 

Happy tweening.

:)

  • Like 5
Link to comment
Share on other sites

Great demo, Craig!

 

Yup, tweenFromTo() can be incredibly helpful.

 

If you want to get totally nuts, you can build a timeline out of tweenFromTo()s for crazy control.

 

*** be sure to use 1.19.0 ***
 
//play red and blue 3 times then play entire timeline


var anotherTimeline = new TimelineLite();
anotherTimeline.add(tl.tweenFromTo(0, "startTest", {repeat:3}))
.add(tl.tweenFromTo("startTest", tl.duration()));

demo: http://codepen.io/GreenSock/pen/akKLYK?editors=0010

  • Like 5
  • Thanks 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.
×
×
  • Create New...