Methods
DotLottieAnimation
instances expose the following methods that can be used to control the animation:
Event | Description |
---|---|
play() | Begins playback from the current animation position. |
pause() | Pauses the animation without resetting its position. |
stop() | Halts playback and returns the animation to its initial frame. |
setSpeed(speed: Int) | Sets the playback speed with the given multiplier. |
setLoop(loop: Bool) | Configures whether the animation should loop continuously. |
setFrame(frame: Float) | Directly navigates the animation to a specified frame. |
load(config: Config) | Loads a new configuration or a new animation. |
loadAnimation(animationId: String) | Loads the animation by id. Animation id’s are visible inside the manifest, recoverable via the manifest() method. |
setMode(mode: Mode) | Sets the animation play mode. |
setMarker(marker: String) | Sets the current Lottie marker to use. |
setsegment(segment: (Float, Float)) | Sets the start and end frame of the animation. |
setBackgroundColor(color: CIImage) | Sets the background color of the animation. |
setFrameInterpolation(useFrameInterpolation: Bool) | Use frame interpolation or not. |
resize(width: Int, height: Int) | Manually resize the animation. |
setTheme(_ themeId: String) | Load the theme. |
setThemeData(_ themeData: String) | Load and apply the theme data. |
setSlots(_ slots: String) | Load the slot data. |
resetTheme() | Remove the applied theme. |
activeThemeId() | Get the id of the current theme. |