Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a lifecycle event that can listen to the completion of each repetition? #960

Open
zhengpq opened this issue Jun 21, 2023 · 0 comments

Comments

@zhengpq
Copy link

zhengpq commented Jun 21, 2023

popmotion is an efficient tool to help me implement animations,but i find that when i start a repeat animation, i can not find a way to do something when each repeat complete. Here is a example:

// suppose that i want to init style  at some point
const styleInit = () => {}

 //animation code
animate({
      from: 0,
      to: 40,
      ease: easeOut,
      duration: 250,
      repeat: Infinity,
      repeatDelay: 5000,
      onUpdate: (latest) => {},
      /**
       * I want to init the style, but i find that this will
       * not be called when each repeat complete because the animation repeats
       */
      onComplete() {
        styleInit();
      },
    });

how to solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant