Jump to content
Search Community

Reset Animation On Change of Index

shMattyP93 test
Moderator Tag

Recommended Posts

I'm currently creating a site using pagePiling.js plugin, and firing animations depending on the index of the page. Is there a way I can reset an animation once the index changes so if the user goes backwards the animation will play again?

 

This is the current simple code:
 

if(index == 2){
   scene1Tween.play();
}

and here is something I thought would work but did not:
 

if(index == 2){
   scene1Tween.play();
}else{
  scene1Tween.invalidate().restart();
}

Thanks in advance for any assistance!

Link to comment
Share on other sites

Hey shMattyP93. It's pretty hard to help out without seeing exactly what you're doing between slides/your setup. It looks like you're trying to reuse the same tween/timeline for all of your different animations?

 

Can you please try recreating the issue minimally on CodePen or something? Preferably without pagePiling.js with just some colored shapes animating. The simpler the better (that still recreates your issue).

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