Events

The DotLottie instance emits the following events that can be listened to via the addEventListener method:

EventDescriptionEvent Parameter (Type and Fields)
loadEmitted when the animation is loaded.LoadEvent { type: 'load' }
loadErrorEmitted when there’s an error loading the animation.LoadErrorEvent { type: 'loadError', error: Error }
playEmitted when the animation starts playing.PlayEvent { type: 'play' }
pauseEmitted when the animation is paused.PauseEvent { type: 'pause' }
stopEmitted when the animation is stopped.StopEvent { type: 'stop' }
loopEmitted when the animation completes a loop.LoopEvent { type: 'loop', loopCount: number }
completeEmitted when the animation completes.CompleteEvent { type: 'complete' }
frameEmitted when the animation reaches a new frame.FrameEvent { type: 'frame', currentFrame: number }
destroyEmitted when the animation is destroyed.DestroyEvent { type: 'destroy' }
freezeEmitted when the animation is freezed and the animation loop stops.FreezeEvent { type: 'freeze' }
unfreezeEmitted when the animation is unfreezed and the animation loop resumes.UnfreezeEvent { type: 'unfreeze' }
renderEmitted when a new frame is rendered to the canvas.RenderEvent { type: 'render', currentFrame: number }