compose/ui/DotLottieAnimation Composable Function API Reference
This reference details the parameters and their functionalities for the DotLottieAnimation
composable function, enabling developers to integrate and control dotLottie animations within their Jetpack Compose UIs.
Parameters
Parameter | Description | Type | Default Value |
---|---|---|---|
modifier | The modifier to be applied to the animation view. | Modifier | Modifier |
source * | The URL source of the animation. | DotLottieSource | null |
autoplay | Determines if the animation will start playing automatically. | Boolean | false |
loop | Determines whether the animation should loop. | Boolean | false |
useFrameInterpolation | Enables or disables frame interpolation for smoother animation. | Boolean | true |
themeId | The themeId to be loaded | String | null |
marker | The segment name or marker to be played | String | null |
speed | The playback speed of the animation. | Float | 1f |
segment | The segment to be played | Pair<Float, Float> | null |
playMode | The play mode of the animation (e.g., forward, reverse). | Mode | Mode.FORWARD |
controller | The controller for managing animation playback and state. | DotLottieController | null |
layout | Sets the the layout of the Animation | Layout | createDefaultLayout() |
eventListeners | A list of event listeners for animation events. | List<DotLottieEventListener> | emptyList() |
Functionality
- Loading Animations: The
DotLottieAnimation
composable function supports loading animations from various sources, including URLs 1, asset files 2, or raw data 3. At least one source must be provided. - Playback Control: The function integrates with
DotLottieController
for controlling animation playback, including play, pause, and stop functionalities. The autoplay and loop parameters provide initial playback behavior. - Customization: Parameters such as
speed
,playMode
, anduseFrameInterpolation
allow for customization of the animation playback, including its speed, direction, and smoothness. - Event Handling: The eventListeners parameter allows developers to attach multiple event listeners to handle various animation events, such as loading errors or completion.
Example Usage
This API reference provides a comprehensive overview of the DotLottieAnimation
composable function, enabling developers to effectively utilize dotLottie animations within their Jetpack Compose applications.