Interpolation helper for animations
Implements the Promise API with an additional "cancel" method. The promise is resolved with true when the animation is completed and false if the animation is cancelled.
true
false
const anim = new Animation({ properties: { width: {start: 100, end: 200} }, duration: 5000, onTick: (properties) => element.style.width = `${properties.width}px`;});anim.then((completed) => ...);anim.cancel(); Copy
const anim = new Animation({ properties: { width: {start: 100, end: 200} }, duration: 5000, onTick: (properties) => element.style.width = `${properties.width}px`;});anim.then((completed) => ...);anim.cancel();
the type of interpoalted properties
Cancels the animation
Promise chaining
Optional
Called when the animation is complete (true) or cancelled (false)
Interpolation helper for animations
Implements the Promise API with an additional "cancel" method. The promise is resolved with
true
when the animation is completed andfalse
if the animation is cancelled.Example