The teacher holds the Animation remote from box.animate(): write your own keyframes, play, pause, reverse or cancel, and the board reads playState…
CSS animations are hard to drive from JS (at most you swap a class). Hand-made requestAnimationFrame animations work out every frame themselves. WAAPI sits in between: declarative like CSS, yet it can be paused, reversed, jumped and awaited through anim.finished.
Keyframes are JS objects, and what comes back is the remote
[{ opacity: 1 }, { opacity: 0 }]) or an object per property ({ opacity: [1, 0] }), not a string 'opacity: 0'. Property names are camelCase: backgroundColor.fill: 'none': after the end the effect lets go. Use fill: 'forwards' or 'both' to hold the last keyframe, or set the end style yourself in anim.finished.then(...).width/left animation feels janky Just as in CSS: animate transform and opacity, which can run on the compositor while the main thread is busy. left/width trigger layout every frame and stall when the main thread is stuck. Try the "busy main thread" button.currentTime slider The Animation pauses and the card follows the time you pick. A plain CSS animation cannot do this.reverse() while it runs It turns round at once, from where it is.fill: none, wait for the end The card goes back to the start: the effect lets go once the time is up.'background-color', then animate() No error, yet getKeyframes() leaves it out: dropped silently.