Jump to content
GreenSock

Sean_has_started_coding

Animation not ending

Moderator Tag

Recommended Posts

Hello all

 

Hope everyone is well.

I have put together an animation with a number of elements repeat indefinitely. Because of this, the animation does not end.

I am sure there's a simple fix for this, but I can't see how I can end the animation.
At the end of all my other animations, the text in the button switches to 'Play' but in this animation, the text 'Pause' is visible indefinitely.
(Please disregard the missing image for now)
Any help as ever would be appreciated.

Thank you.

See the Pen vYVbzPe by HappyGooner (@HappyGooner) on CodePen

Link to comment
Share on other sites

Hi @Sean_has_started_coding I don't have time to fix your animation, but I would advise creating functions of sections of the timeline and add those to a main timeline, this will not only be easier to manage (and edit at a later time), but allows you to have looping stuff, without clogging up the main timeline. 

 

Here is an example I've made years ago (don't pay attention to the old GSAP syntax), but the logic should still apply. At line 74 I have a main timeline which has all kinds of other timelines add to it, some repeating, some not and as you can see you get a console.log when the mainTl has finished. Hope it helps and happy tweening! 

 

See the Pen WMdWxG?editors=0011 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 2
Link to comment
Share on other sites

That's great, thanks for your reply; yes I do need to use functions more.

I will have a look at cleaning the code tomorrow. Appreciate your time and advice.

Link to comment
Share on other sites

I'm not quite sure what you're trying to accomplish with the infinite repeats on some of the tweens, but this thread may offer some helpful info too.

 

  • Like 1
Link to comment
Share on other sites

Brilliant, thanks both. This will help me clean up and timeline and ensure my issues is fixed.

Have a great evening.

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