anime
anime copied to clipboard
keyframe callback
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.
big +1, this would be super helpful