Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
kubasulek2

reversing animation on click causes strange behavior

Recommended Posts

Hi, first of all i want to thank you for GSAP being awesome.  Creating my site, i noticed strange behavior. I have complex  animation, wchich goes forward/backward depending on wether element is clicked even or odd times. Everythings works pretty well exept for one part. I have svg stars empty inside with clipped rect to animate 'loading' the stars. While rest of animation works back and forth without any issues,  here works well for the first time, then each consecutive time looks like there is one more animation interfering with the rest. It,s hard to explain it precisely, due to my limited english, however it's clear in the example i attached . Just click a few time and observe the effect. For demostration purposed, I removed all well-functioning parts of animation. 

See the Pen BXLqzV by kubasulek2 (@kubasulek2) on CodePen

Link to comment
Share on other sites

  • kubasulek2 changed the title to reversing animation on click causes strange behavior

Hey @kubasulek2,

 

Welcome to the GreenSock Forum.

 

Try for example . .play(0) - here:

 

// .play()  begins playing forward, optionally from a specific time (
// by default playback begins from wherever the playhead currently is).
// so try:

counter % 2 ? tlSkills.reverse() : tlSkills.play(0);

 

Happy tweening ...

Mikel

 

 

  • Like 1
Link to comment
Share on other sites

Hi Mikel. Actually the problem was hidden in the  code I removed for the example. So you could't see it.  It was   on events and functions design side rather that GSAP. Anyway thanks for quick reply 

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