LottieAnimation

Class representing a single animation inside a dotLottie. Contains the animation data and assets.

AnimationOptions

export interface AnimationOptions {
  id: string;
  autoplay?: boolean;
  direction?: number;
  loop?: boolean;
  data?: AnimationData;
  defaultActiveAnimation?: boolean;
  url?: string;
  playMode?: PlayMode;
  speed?: number;  
}
data?: AnimationData

Lottie animation data.

defaultActiveAnimation?: boolean

If true will be the first animation to play when loaded on a dotlottie-player with multiple animations.

url?: string

A URL of where to fetch the animation. The animation isn't fetched when the LottieAnimation is constructed but on a call to DotLottie.build() or one of its export methods (toJson, toArrayBuffer, toBase64, toBlob).

Additional options

id: string

A unique id for the animation.

autoplay?: boolean
direction?: number;

Either 1 for forward and -1 for backwards playback.

loop?: boolean;
playMode?: PlayMode

Can either be 'normal' or 'bounce'.

speed?: number

Animation playback speed.

Methods

Export and util methods

async toArrayBuffer({inlineAssets?: boolean}): Promise<ArrayBuffer>

Returns the animation data as an ArrayBuffer.

async toBase64({inlineAssets?: boolean}): Promise<string>

Returns the animation data as a Base64 encoded string.

async toBlob({inlineAssets?: boolean}): Promise<Blob>

Returns the animation data as a Blob.

toJSON({inlineAssets?: boolean}): Promise<Animation>

Return the animation data as a JSON object.

If the animation data is not already set, it will be fetched from the provided url.

Last updated