Config

The DotLottie constructor accepts a config object with the following properties:

Property nameTypeRequiredDefaultDescription
autoplaybooleanfalseAuto-starts the animation on load.
loopbooleanfalseDetermines if the animation should loop.
canvasHTMLCanvasElement✔️undefinedCanvas element for animation rendering.
srcstringundefinedURL to the animation data (.json or .lottie).
speednumber1Animation playback speed. 1 is regular speed.
datastring | ArrayBufferundefinedAnimation data provided either as a Lottie JSON string or as an ArrayBuffer for .lottie animations.
modestring”forward”Animation play mode. Accepts “forward”, “reverse”, “bounce”, “reverse-bounce”.
backgroundColorstringundefinedBackground color of the canvas. Accepts 6-digit or 8-digit hex color string (e.g., “#000000”, “#000000FF”),
segment[number, number][0, totalFrames - 1]Animation segment. Accepts an array of two numbers, where the first number is the start frame and the second number is the end frame.
renderConfigRenderConfig{}Configuration for rendering the animation.
useFrameInterpolationbooleantrueDetermines if the animation should update on subframes. If set to false, the original AE frame rate will be maintained. If set to true, it will refresh at each requestAnimationFrame, including intermediate values. The default setting is true.
markerstringundefinedThe lottie named marker to play.
layoutLayoutundefinedThe animation layout configuration.
themeIdstringundefinedThe ID of the dotLottie theme to initially use.