-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Renderer Settings
for svg and canvas renderer it simulates the behavior of the preserveAspectRatio property on svgs. https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio
var animation = lottie.loadAnimation({
...
rendererSettings: {
preserveAspectRatio: 'xMidYMid meet'
}
})
if set to true, the svg renderer will add rendering elements to the svg markup progressively instead of all at the beginning.
Useful if you have a very long animation and the initial loading is slow.
for the canvas renderer, if you want to pass a shared canvas context.
if set to false, canvas will not be erased between frames. Useful when the canvas context is shared with the rest of the application
will add a class to the root element of the animation.
Useful for styling via CSS or referencing via Javascript.
will add an id to the root element of the animation.
Useful for styling via CSS or referencing via Javascript.
if true will set display to hidden when element has opacity set to 0. Default is true.
If false
, expressions are completely disabled.
if true will not add width, height and transform properties to root element
if passed it will override the viewBox set by default on the animation
supports all presetAspectRatio values from image elements. Defaults to xMidYMid slice
sets the focusable attribute to svg elements
In order to render drop shadows, the filter size needs to be set to increase the render surface of the element. You can set the x, y, width and height of filters manually.
var animation = lottie.loadAnimation({
...
rendererSettings: {
filterSize: {
width: '200%',
height: '200%',
x: '-50%',
y: '-50%',
}
}
})