Pixen JavaScript API
    Preparing search index...

    Interface Animation

    Timeline and frame operations for an animation document.

    interface Animation {
        frames: readonly Frame[];
        size: Size;
        shouldLoop: boolean;
        defaultDuration: number;
        addFrame(): Frame;
        insertFrameAtIndex(index: number): Frame | null;
        removeFrame(frame: Frame): boolean;
        duplicateFrame(frame: Frame): Frame | null;
        moveFrame(frame: Frame, index: number): boolean;
        resize(size: Size, options?: AnimationResizeOptions | null): void;
    }
    Index
    frames: readonly Frame[]

    Frames in playback order.

    size: Size

    The animation dimensions in pixels.

    shouldLoop: boolean

    Whether playback repeats after the final frame.

    defaultDuration: number

    Default duration assigned to new frames, in seconds.

    • Returns Frame

      A new frame appended to the timeline.

    • Inserts a new frame.

      Parameters

      • index: number

        Zero-based insertion index, including the current frame count.

      Returns Frame | null

      The new frame, or null for an invalid index.

    • Removes a frame while preserving at least one frame.

      Parameters

      • frame: Frame

        A frame belonging to this animation.

      Returns boolean

      Whether the frame was removed.

    • Duplicates a frame immediately after its source.

      Parameters

      • frame: Frame

        A frame belonging to this animation.

      Returns Frame | null

      The duplicate, or null when the frame is invalid.

    • Moves a frame within the timeline.

      Parameters

      • frame: Frame

        A frame belonging to this animation.

      • index: number

        Destination index within the frame list.

      Returns boolean

      Whether the frame was moved.