anime icon indicating copy to clipboard operation
anime copied to clipboard

keyframe callback

Open mracette opened this issue 5 years ago • 1 comments

Allow a callback parameter (keychange?) that runs a function following the completion of each keyframe:

const frames = [100, 200, 300]

anime({
  target: myTarget,
  easing: 'linear',
  duration: 1000
  keyframes: frames
  keychange: (frame, index) => {
    console.log(`value of frame ${index} is ${frame}`)
  }
})

The update and change callbacks run every frame, so it's very difficult to extract when you would want to run a function that corresponds with a keyframe.

The obvious implication here is that you could sync the execution of functions in an application with the execution of keyframes in animejs.

mracette avatar Feb 08 '20 21:02 mracette

big +1, this would be super helpful

swilkewitz avatar May 31 '21 01:05 swilkewitz