Animating on canvas #118
-
Hey! I'm trying to use Motion One for animating objects on a canvas but I'm not sure how I would do this exactly. I've found that there is the progress function which the docs recommend to use. My code looks like this const animation = animate(
(progress) => {
if (anim.playState !== 'running') return
// Update canvas and redraw
},
{ duration: 3, repeat: Infinity }
) Is this the correct way to create a render loop that updates the canvas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yeah that’s right - this is currently to emulate how WAAPI behaves, running even while paused and the way it overrides any other css or styles but I have been thinking about changing it to avoid unnecessary work. |
Beta Was this translation helpful? Give feedback.
Yeah that’s right - this is currently to emulate how WAAPI behaves, running even while paused and the way it overrides any other css or styles but I have been thinking about changing it to avoid unnecessary work.