Skip to content

Commit

Permalink
Update Compose API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Peal committed May 27, 2022
1 parent 3a429d8 commit 65bc0ba
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
15 changes: 15 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# 5.2.0
### Bugs Fixed
* De-dupe gradient stops. On pre-Oreo devices, if you had color and opacity stops in the same place and used hardware acceleration, you may have seen artifacts at the stop positions as of 5.1.1 [#20814](https://github.com/airbnb/lottie-android/pull/2081)

# 5.1.1
### New Features
* Added support for gradient opacity stops at different points than color stops ([#2062](https://github.com/airbnb/lottie-android/pull/2062))
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG_COMPOSE.md
@@ -1,3 +1,6 @@
# 5.2.0
* [BREAKING CHANGE] LottieAnimation now takes progress as a `() -> Float` rather than a `Float`. This allows Lottie to redraw without triggering a recomposition every time progress updates. For more information, refer to the Compose [phase docs](https://developer.android.com/jetpack/compose/phases). The existing API will exist as deprecated for one more release but will then be removed. [#2078](https://github.com/airbnb/lottie-android/pull/2078).

# 5.1.1
* Add support for completable animations in tests ([#2051](https://github.com/airbnb/lottie-android/pull/2051))

Expand Down
Expand Up @@ -32,7 +32,7 @@ import kotlin.math.roundToInt
*
* @param composition The composition that will be rendered. To generate a [LottieComposition], you can use
* [rememberLottieComposition].
* @param progressProvider A provider for the progress (between 0 and 1) that should be rendered. If you want to render a
* @param progress A provider for the progress (between 0 and 1) that should be rendered. If you want to render a
* specific frame, you can use [LottieComposition.getFrameForProgress]. In most cases, you will want
* to use one of the overloaded LottieAnimation composables that drives the animation for you.
* The overloads that have isPlaying as a parameter instead of progress will drive the
Expand Down Expand Up @@ -69,7 +69,7 @@ import kotlin.math.roundToInt
@Composable
fun LottieAnimation(
composition: LottieComposition?,
progressProvider: () -> Float,
progress: () -> Float,
modifier: Modifier = Modifier,
outlineMasksAndMattes: Boolean = false,
applyOpacityToLayers: Boolean = false,
Expand Down Expand Up @@ -114,7 +114,7 @@ fun LottieAnimation(
drawable.isApplyingOpacityToLayersEnabled = applyOpacityToLayers
drawable.maintainOriginalImageBounds = maintainOriginalImageBounds
drawable.clipToCompositionBounds = clipToCompositionBounds
drawable.progress = progressProvider()
drawable.progress = progress()
drawable.setBounds(0, 0, composition.bounds.width(), composition.bounds.height())
drawable.draw(canvas.nativeCanvas, matrix)
}
Expand All @@ -127,6 +127,7 @@ fun LottieAnimation(
* @see LottieAnimation
*/
@Composable
@Deprecated("Pass progress as a lambda instead of a float. This overload will be removed in the next release.")
fun LottieAnimation(
composition: LottieComposition?,
@FloatRange(from = 0.0, to = 1.0) progress: Float,
Expand Down Expand Up @@ -192,18 +193,18 @@ fun LottieAnimation(
iterations,
)
LottieAnimation(
composition,
{ progress },
modifier,
outlineMasksAndMattes,
applyOpacityToLayers,
enableMergePaths,
renderMode,
maintainOriginalImageBounds,
dynamicProperties,
alignment,
contentScale,
clipToCompositionBounds,
composition = composition,
progress = { progress },
modifier = modifier,
outlineMasksAndMattes = outlineMasksAndMattes,
applyOpacityToLayers = applyOpacityToLayers,
enableMergePaths = enableMergePaths,
renderMode = renderMode,
maintainOriginalImageBounds = maintainOriginalImageBounds,
dynamicProperties = dynamicProperties,
alignment = alignment,
contentScale = contentScale,
clipToCompositionBounds = clipToCompositionBounds,
)
}

Expand Down

0 comments on commit 65bc0ba

Please sign in to comment.