Methods
The following methods are accessible using the player instance.
enterInteractiveMode: (stateId) => void
enterInteractiveMode: (stateId) => void
Activate the passed state machine.
getContainer: () => HTMLDivElement | undefined
getContainer: () => HTMLDivElement | undefined
Returns the div element containing the Lottie animation.
getCurrentAnimationId: () => string | undefined
getCurrentAnimationId: () => string | undefined
Returns the currently playing animation Id.
getLottie: () => AnimationItem | undefined
getLottie: () => AnimationItem | undefined
Return the AnimationItem
instance.
getManifest: () => Manifest | undefined
getManifest: () => Manifest | undefined
Returns the .lottie
Manifest.
next: (getOptions) => void
next: (getOptions) => void
Plays the next animation.
Usage:
play: (indexOrId, getOptions) => void
play: (indexOrId, getOptions) => void
Starts playing. Or you can pass indexOrId
to switch and play another animation.
Usage:
previous: (getOptions) => void
previous: (getOptions) => void
Plays the previous animation from the .lottie
manifest.
playOnScroll: (scrollOptions) => void
playOnScroll: (scrollOptions) => void
Sync the animation to the scrolling of the page.
stopPlayOnScroll() => void
stopPlayOnScroll() => void
Stop playing on scroll.
playOnShow(playOnShowOptions) => void
playOnShow(playOnShowOptions) => void
Play the animation when it appears on screen.
stopPlayOnShow() => void
stopPlayOnShow() => void
Stop play on show.
reset: () => void
reset: () => void
Goes back to initial animation. activeAnimationId
or index 0
.
resize: () => void
resize: () => void
Resize the animation.
getCurrentAnimationId: () => string | undefined
getCurrentAnimationId: () => string | undefined
Returns the currently active animation Id.
getState: () => DotLottiePlayerState
getState: () => DotLottiePlayerState
Returns the current player states.
getVersions() => { lottieWebVersion: string, dotLottiePlayerVersion: string }
getVersions() => { lottieWebVersion: string, dotLottiePlayerVersion: string }
Returns the version of lottie-web and the dotlottie player.
Returns
Type: Versions
setAutoplay: (autoplay: boolean) => void
setAutoplay: (autoplay: boolean) => void
Sets autoplay
setBackground: (background: string) => void
setBackground: (background: string) => void
Sets background
setDefaultTheme: (defaultTheme: string) => void
setDefaultTheme: (defaultTheme: string) => void
Applies theme
setDirection: (direction: AnimationDirection) => void
setDirection: (direction: AnimationDirection) => void
Sets play direction direction
setHover: (hover: boolean) => void
setHover: (hover: boolean) => void
Sets play on hover
setIntermission: (intermission: number) => void
setIntermission: (intermission: number) => void
Sets the pause between loops
setLoop: (loop: number | boolean) => void
setLoop: (loop: number | boolean) => void
Sets loop
setPlayMode: (mode: PlayMode) => void
setPlayMode: (mode: PlayMode) => void
Sets play mode.
setSpeed: (speed: number) => void
setSpeed: (speed: number) => void
Sets speed
seek: (frame: number) => void
seek: (frame: number) => void
Seek to a frame.
revertToManifestValues: (playbackKeys) => void
revertToManifestValues: (playbackKeys) => void
It ignores the props sets by the player and uses manifest.
Usage:
Last updated