Metriakon Posted October 26, 2021 Share Posted October 26, 2021 Hi I have a problem with reverse animation after finishing. I get this animation from examples. Ex. i want to play animation in Timeline and onComplete i want to play the same animation in reverse. const timeline = gsap.timeline({ paused: true, scrollTrigger: { trigger: 'section', start: '0px', end: '+=200%', pin:true, scrub: true } }) const t1 = gsap.timeline({ repeat:0, repeatDelay:0}) .to('.logo',1,{y:-100+'%'}) timeline .add('SECTION_0') .add(t1) .addPause() .add('SECTION_1') .to('.m', {duration:(i)=>[0.8,1.3][i], y:-10266, ease:'steps(29)', stagger:-0.3}, 0) // THIS ANIMATION .to('.box', {duration:2, scale:1.1, transformOrigin:'50% 50%', ease:'power2'}, 0) // THIS ANIMATION .addPause() .add('SECTION_2') //THEN I WANT TO REVERSE ANIMATION THERE .to('.mainimg-wrapper',1,{x:100+'%'},'SECTION_2') .addPause() See the Pen YzqWVKP by creativeocean (@creativeocean) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted October 26, 2021 Solution Share Posted October 26, 2021 There are many ways to do this, but if you just want it to play forward once and then backward once, all you need to do is set repeat: 1, yoyo: true on your animation. Is that what you're looking for? 1 Link to comment Share on other sites More sharing options...
Metriakon Posted October 27, 2021 Author Share Posted October 27, 2021 11 hours ago, GreenSock said: There are many ways to do this, but if you just want it to play forward once and then backward once, all you need to do is set repeat: 1, yoyo: true on your animation. Is that what you're looking for? Ough, yeah thats help Thanks for answer and sorry for a probably silly question due to my poor English proficiency.. Link to comment Share on other sites More sharing options...
GreenSock Posted October 27, 2021 Share Posted October 27, 2021 No problem! Glad it was a simple fix. Happy tweening! 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