Jump to content
Search Community

change time scale on the reverse of a tween (using yoyo) ?

gareth test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

  • Solution



This should work the way you intend:

var type = gsap.timeline({
  repeat: -1

var defaults = {
  opacity: 1,
  yoyo: true,
  repeat: 1,
  repeatDelay: 1,
  delay: 1,
  onRepeat() {
  onStart() {

Is a peculiar setup so we have to access the parent timeline on each instance as modifying the timescale of each instance won't work as you expect.


Hopefully this helps.


Happy Tweening!

Link to comment
Share on other sites

22 minutes ago, gareth said:

When you say it's a peculiar setup, is there a better way to do this? 

I don't know I'll have to dig deep into it and see if there is another way. Basically what could throw some users off is the fact that the approach is updating the parent timeline's timescale and not the specific instance's timescale. In those cases you should always work with the parent timeline since that's the one actively affecting each tween's playhead. That's something it might take some time to sink in if you're starting with GSAP, but when you get a grasp on the concept it becomes second nature. Timelines are just containers of Tweens with some additional options and properties of course.


Good luck with your project!

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