Events
Enumerates the Lottie Player events that you can use to capture playback status.
Use the
addEventListener
calls to listen to the following exposed events.Name | Description |
---|---|
load | Animation data is loaded. |
error | An animation source cannot be parsed, fails to load or has format errors. |
ready | Animation data is loaded and player is ready. |
play | Animation starts playing. |
pause | Animation is paused. |
stop | Animation is stopped. |
freeze | Animation is paused due to player being invisible. |
loop | An animation loop is completed. |
complete | Animation is complete (all loops completed). |
frame | A new frame is entered. |
As an example, the following code demonstrates how to capture the ready event:
let animation = document.getElementById("exploding-bird");
animation.addEventListener("ready", () => {
console.log("You've captured the ready event!");
});
Last modified 1yr ago