cheister Posted December 17, 2019 Share Posted December 17, 2019 Hi, I am currently building GUI elements which should show different animations on different states but I need a smooth transition. How can I achieve a immediate but smooth transition between e.g. the following tweens State 1: Should rotate only and should not scale tween = TweenLite.fromTo(box, 10, {rotation: 0}, {rotation: 360, ease: "linear" , repeat: -1}) State 2 Should yoyo scale only should not scale tween = TweenLite.fromTo(box, 1, {scaleX: 1, scaleY: 1}, {scaleX: 0.8, scaleY: 0.8, ease: "bezier", yoyo: true, repeat: -1 State 3 ... I tried several methods by just changing the tween, but then I need to kill() the current tween and restart() the tween which creates jumps in the animation. Any help appreciated! Link to comment Share on other sites More sharing options...
ZachSaucier Posted December 17, 2019 Share Posted December 17, 2019 Hey cheister and welcome to the GreenSock forums! 26 minutes ago, cheister said: How can I achieve a immediate but smooth transition between e.g. the following tweens It's technically impossible to have a transition be both immediate (i.e. duration of 0) and smooth (which requires a duration > 0). What I'm guessing you're wanting is a way to slow down an animation to a stop and then slowly start another animation, correct? GSAP's timeScale ability is perfect for that: See the Pen Powbvad?editors=0010 by GreenSock (@GreenSock) on CodePen Note that I don't make use of paused/playing at all - I'm just setting or tweening each timeline's (or tween's if you'd prefer to switch them out) timeScale. Side note: it looks like you're mixing up some GSAP 3 formatting (like the string ease "bezier") with GSAP 2 formatting (like the duration parameter). We recommend using all GSAP 3 formatting like I did in the demo above, but you'll need to load GSAP 3 to have your code work as you're expecting even if you don't use all the GSAP 3 formatting. 1 Link to comment Share on other sites More sharing options...
cheister Posted December 17, 2019 Author Share Posted December 17, 2019 "Immediate" was misleading, it just meant that transition between the two states / tweens should start immediately, e.g. on click. Many thanks for your solution which looks perfectly what I was looking for! Link to comment Share on other sites More sharing options...
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