Photo Sphere Viewer
    Preparing search index...

    Class Animation<T>

    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.

    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

    Implements

    • PromiseLike<boolean>
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    cancelled: boolean = false
    resolved: boolean = false

    Methods

    • Promise chaining

      Type Parameters

      • U

      Parameters

      • OptionalonFulfilled: (complete: boolean) => U | PromiseLike<U>

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

      Returns Promise<U>