Sets or gets the source of the Lottie animation.
Setting the src
property changes the displayed Lottie element to
the Lottie animation found at the specified src
value.
Getting the src
property returns the source of the
current Lottie animation.
The src
property can either be an external Lottie animation URL, for example, 'https://assets6.lottiefiles.com/private_files/lf30_vuxs5lpt.json'
, or a valid Lottie JSON.
A valid Lottie JSON file should follow this schema animation.json file. While your Lottie JSON file doesn't need all the key-value properties listed in this file, it must include the following properties and types for your Lottie JSON file to be valid.
Properties | Type |
---|---|
"w", "h", "ip", "op" | Number |
"assets", "layers" | Array of objects |
Tip: To set the src
property to a valid Lottie JSON, you can put it in a public file and import it in your page code.