Summary

Interpolation helper for animations

Description

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.

Example

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();

Type Parameters

  • T = any

    the type of interpoalted properties

Hierarchy

  • Animation

Implements

  • PromiseLike<boolean>

Constructors

Properties

Methods

Constructors

Properties

cancelled: boolean = false
resolved: boolean = false

Methods

  • Promise chaining

    Type Parameters

    • U

    Parameters

    • Optional onFulfilled: ((complete) => U | PromiseLike<U>)

      Called when the animation is complete (true) or cancelled (false)

      Optional
        • (complete): U | PromiseLike<U>
        • Parameters

          • complete: boolean

          Returns U | PromiseLike<U>

    Returns Promise<U>

Generated using TypeDoc