Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

Properties

assets: PreComp[] = []
author?: string
finalFrame: number = ...
frameRate: number = 60
has3dLayers: boolean = false
height: number = 512
initialFrame: number = 0
layers: Layer[] = []
name?: string = "animation"
tgsFlag: boolean = true
version: string = "5.0.0"
width: number = 512

Methods

  • frameAt(percentage: number): number
  • setAuthor(author: undefined | string): Lottie
  • setDimensions(width: number, height: number): Lottie
  • setFinalFrame(finalFrame: number): Lottie
  • setFrameRate(frameRate: number): Lottie
  • setHeight(height: number): Lottie
  • setInitialFrame(initialFrame: number): Lottie
  • setWidth(width: number): Lottie
  • Transforms this object into a lottie json string

    This stringification may result in a different ordering of keys compared to JSON.stringify since some lottie players require keys to be in a certain order.

    The result is not compressed.

    // example usage
    import pako from "pako";
    const text = animation.toTgsString();
    const zipped = pako.gzip(text, { level: 9 });
    promptDownload(new Blob([zipped], { type: "application/gzip" }));

    The resulting compressed file should be less than 64KiB to be displayed correctly in the Telegram app (Telegram Desktop has a different limit) In node environments, zopfli may result in better compression than zlib.

    spaces - number of spaces for pretty-printing precision - decimal places to round to

    Parameters

    Returns string

Generated using TypeDoc