Skip to content

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

@zhengpq

Description

@zhengpq

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions