Jump to content
Search Community

Animation after click

Avargas test
Moderator Tag

Recommended Posts

Hello, I am new to GSAP and had a question. I made a timeline that I posted above. I wanted the timeline to stop after the second tween then after a click of the elements have the two remaining tweens occur. I was wondering if this was possible on the same timeline or would I have to create another one? Thank you. 

See the Pen yLOYqjX by avar1207 (@avar1207) on CodePen

Link to comment
Share on other sites

@Avargas

 

That is absolutely possible with the same timeline.

As @Richard1604 mentioned there is the nifty .addPause() method for timelines.

 

You could simply just throw it in after your first two tweens, add an eventlistener for the click-event onComplete of your second tween and run a timeline.resume() when that chosen element is clicked. Adjust the timing for your third tween, so it doesn't start two seconds late, et voilá:

Your timeline resumes on click.

 

 

See the Pen 6dc677cca42d34d2d20b3e589f94e4c2 by akapowl (@akapowl) on CodePen

 

 

Check the docs for more information and all the other beautiful stuff that GSAP gives to control your animations with ease.

https://greensock.com/docs/v2/TimelineMax/addPause()

 

 

  • Like 2
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...