Thomas James Thorstensson Posted January 30, 2020 Posted January 30, 2020 Hello, It seems to set timeScale I can not set it as creation parameter. Maybe I forgotten something here as I think I've done that before: this.tl = gsap.timeline({ repeat: defaultValues.customVariable3, repeatDelay: 2, // THIS DOESNT WORK timeScale: defaultValues.customVariable5 || 1 // * this will later be defaultValues.animationSpeed }); // THIS WORKS! this.tl.timeScale(defaultValues.customVariable5 || 1) Not a biggie as the second works but just checking if any fellow GSAP Mphil could advise me on why the first does not. Stay green, stay alive Thomas
ZachSaucier Posted January 30, 2020 Posted January 30, 2020 Hey Thomas. As far as I know, this has been true in GSAP. Here's the same thing in GSAP 2: See the Pen gObNONZ by GreenSock (@GreenSock) on CodePen. Maybe @GreenSock can shed some light on why this is the case.
GreenSock Posted January 30, 2020 Posted January 30, 2020 Yep, this is all very intentional. The problem is that it's relatively common for people to want to animate the timeScale of other animations, so what would you expect this to do?: let animation = gsap.to(...); // umm...should this tween's timeScale be 0.5 to start or should we animate animation.timeScale() to 0.5??? gsap.to(animation, {timeScale:0.5, duration:2}); See the problem? It's inherently ambiguous. So to set the initial timeScale of a tween, you can just use the timeScale() method which is quite easy with chaining: gsap.to(...).timeScale(0.5) Does that clear things up? 2
Thomas James Thorstensson Posted January 30, 2020 Author Posted January 30, 2020 25 minutes ago, GreenSock said: Yep, this is all very intentional. The problem is that it's relatively common for people to want to animate the timeScale of other animations, so what would you expect this to do?: let animation = gsap.to(...); // umm...should this tween's timeScale be 0.5 to start or should we animate animation.timeScale() to 0.5??? gsap.to(animation, {timeScale:0.5, duration:2}); See the problem? It's inherently ambiguous. So to set the initial timeScale of a tween, you can just use the timeScale() method which is quite easy with chaining: gsap.to(...).timeScale(0.5) Does that clear things up? Ahaaaa. Thanks for clarifying. Yes I can see the point now and it makes sense to me. Thanks for taking time! Thomas, over a cup of coffe! 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now