Skip to content

Commit

Permalink
add method to create LottieAnimatable outside of Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhirkevich committed Nov 13, 2024
1 parent 2856117 commit 7f62af5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import kotlinx.coroutines.job
import kotlinx.coroutines.withContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.coroutineContext
import kotlin.js.JsName
import kotlin.time.Duration.Companion.nanoseconds

/**
Expand All @@ -28,6 +29,14 @@ import kotlin.time.Duration.Companion.nanoseconds
@Composable
public fun rememberLottieAnimatable(): LottieAnimatable = remember { LottieAnimatableImpl() }

/**
* Use this to create a [LottieAnimatable] outside of a composable such as a hoisted state class.
*
* @see rememberLottieAnimatable
* @see LottieAnimatable
*/
@JsName("createLottieAnimatable")
public fun LottieAnimatable(): LottieAnimatable = LottieAnimatableImpl()

/**
* Reset the animation back to the minimum progress and first iteration.
Expand Down

0 comments on commit 7f62af5

Please sign in to comment.