Fixed
Status Update
Comments
os...@google.com <os...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 55e219a046bada0311a6e700b755f96426f3fdca
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Wed Aug 02 15:50:11 2023
Support monotonic splines in keyFrames
Adds a class `KeyframesWithSplineSpec` that implements
DurationBasedAnimationSpec with keyframes. It allows the interpolation
of N-dimensional values using Monotonic Splines.
Added under `ExperimentalAnimationSpecApi`.
Relnote: "You may now use `keyframesWithSpline` to interpolate
any N-dimensional value using monotonic splines. It's particularly
useful to interpolate positional values such as Offset, IntOffset,
DpOffset."
Bug: 292114811
Test: MonoSplineTest, KeyframeSplineAnimationTest
Change-Id: I3e5b4a85da8ddf665f7e6e343dd716c6f44de44c
M compose/animation/animation-core/api/current.txt
M compose/animation/animation-core/api/restricted_current.txt
A compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/KeyframesWithSplineBuilderSample.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeAnimationTest.kt
A compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeSplineAnimationTest.kt
A compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/MonoSplineTest.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Animation.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ExperimentalAnimationSpecApi.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/MonoSpline.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedMonoSplineKeyframesSpec.kt
M compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/AnimationDemos.kt
A compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/OffsetKeyframeSplinePlaygroundDemo.kt
A compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/OffsetKeyframeWithSplineDemo.kt
https://android-review.googlesource.com/2690430
Branch: androidx-main
commit 55e219a046bada0311a6e700b755f96426f3fdca
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Wed Aug 02 15:50:11 2023
Support monotonic splines in keyFrames
Adds a class `KeyframesWithSplineSpec` that implements
DurationBasedAnimationSpec with keyframes. It allows the interpolation
of N-dimensional values using Monotonic Splines.
Added under `ExperimentalAnimationSpecApi`.
Relnote: "You may now use `keyframesWithSpline` to interpolate
any N-dimensional value using monotonic splines. It's particularly
useful to interpolate positional values such as Offset, IntOffset,
DpOffset."
Bug: 292114811
Test: MonoSplineTest, KeyframeSplineAnimationTest
Change-Id: I3e5b4a85da8ddf665f7e6e343dd716c6f44de44c
M compose/animation/animation-core/api/current.txt
M compose/animation/animation-core/api/restricted_current.txt
A compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/KeyframesWithSplineBuilderSample.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeAnimationTest.kt
A compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeSplineAnimationTest.kt
A compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/MonoSplineTest.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Animation.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ExperimentalAnimationSpecApi.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/MonoSpline.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedMonoSplineKeyframesSpec.kt
M compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/AnimationDemos.kt
A compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/OffsetKeyframeSplinePlaygroundDemo.kt
A compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/OffsetKeyframeWithSplineDemo.kt
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit e6268721f6a22f5e84d2d244f1d9cad5affa6f1c
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Wed Oct 18 13:58:55 2023
Implement Easing support for KeyframesWithSplineSpec
To be consistent with the default KeyframesSpec implementation.
Relnote: "Added binary search method to primitive list collections."
Bug: 292114811
Test: KeyframeSplineAnimationTest#testMultipleEasing
Change-Id: Iea5d4d0766f0b75cadca190b78b042d3f7ee1c28
M collection/collection/template/generateCollections.sh
A compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/IntListExtensionTest.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeSplineAnimationTest.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/MonoSplineTest.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/IntListExtension.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/MonoSpline.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedMonoSplineKeyframesSpec.kt
https://android-review.googlesource.com/2796739
Branch: androidx-main
commit e6268721f6a22f5e84d2d244f1d9cad5affa6f1c
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Wed Oct 18 13:58:55 2023
Implement Easing support for KeyframesWithSplineSpec
To be consistent with the default KeyframesSpec implementation.
Relnote: "Added binary search method to primitive list collections."
Bug: 292114811
Test: KeyframeSplineAnimationTest#testMultipleEasing
Change-Id: Iea5d4d0766f0b75cadca190b78b042d3f7ee1c28
M collection/collection/template/generateCollections.sh
A compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/IntListExtensionTest.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeSplineAnimationTest.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/MonoSplineTest.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/IntListExtension.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/MonoSpline.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedMonoSplineKeyframesSpec.kt
os...@google.com <os...@google.com> #4
At this point, implementation for keyframes with splines is "complete" for the next compose animation alpha release.
There'll be a few other related things coming on follow-up releases, so keep an eye out onhttps://developer.android.com/jetpack/androidx/releases/compose-animation
There'll be a few other related things coming on follow-up releases, so keep an eye out on
ar...@gmail.com <ar...@gmail.com> #5
Thank you!
pr...@google.com <pr...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.collection:collection:1.4.0-beta02
androidx.collection:collection-iosarm64:1.4.0-beta02
androidx.collection:collection-iossimulatorarm64:1.4.0-beta02
androidx.collection:collection-iosx64:1.4.0-beta02
androidx.collection:collection-jvm:1.4.0-beta02
androidx.collection:collection-linuxx64:1.4.0-beta02
androidx.collection:collection-macosarm64:1.4.0-beta02
androidx.collection:collection-macosx64:1.4.0-beta02
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit 03606e5a01dbde0c22387831a63d586e683822cb
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Mon Aug 21 10:59:06 2023
Support periodic monotonic splines
Added the possibility to make a spline based keyframe periodic. A
periodic spline makes the starting and ending velocity equal.
Defined as a 'periodicBias' property. Float.NaN by default for the
regular monotic spline behavior. Otherwise, 'periodicBias' may be a
value between 0 and 1. It indicates which end of the velocity curve is
modified the most to achieve periodicity.
So, when periodicBias is 0, only the starting velocity is changed to
match the ending velocity. Likewise when periodicBias is 1, only the
ending velocity is changed to match the starting velocity. Hence, at
0.5f, the starting and ending velocity will be the exact average between
the two.
Relnote: "You may now pass a periodicBias value (Float) to `keyframesWithSpline`, this will make it so that the initial and final velocity of the spline are equal. Useful for repeatable animations using splines. The bias indicates how much each velocity (initial and final) gets modified to achieve periodicity."
Bug: 292114811
Test: KeyframeSplineAnimationTest#interpolatedValues_periodic
Change-Id: Ic1e6c4996f8c25055955331384639b57e9ad86db
M compose/animation/animation-core/api/current.txt
M compose/animation/animation-core/api/restricted_current.txt
M compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/KeyframesWithSplineBuilderSample.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeSplineAnimationTest.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/MonoSplineTest.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/MonoSpline.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedMonoSplineKeyframesSpec.kt
M compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/AnimationDemos.kt
M compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/OffsetKeyframeSplinePlaygroundDemo.kt
A compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/PeriodicMonoSplineDemo.kt
https://android-review.googlesource.com/2719922
Branch: androidx-main
commit 03606e5a01dbde0c22387831a63d586e683822cb
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Mon Aug 21 10:59:06 2023
Support periodic monotonic splines
Added the possibility to make a spline based keyframe periodic. A
periodic spline makes the starting and ending velocity equal.
Defined as a 'periodicBias' property. Float.NaN by default for the
regular monotic spline behavior. Otherwise, 'periodicBias' may be a
value between 0 and 1. It indicates which end of the velocity curve is
modified the most to achieve periodicity.
So, when periodicBias is 0, only the starting velocity is changed to
match the ending velocity. Likewise when periodicBias is 1, only the
ending velocity is changed to match the starting velocity. Hence, at
0.5f, the starting and ending velocity will be the exact average between
the two.
Relnote: "You may now pass a periodicBias value (Float) to `keyframesWithSpline`, this will make it so that the initial and final velocity of the spline are equal. Useful for repeatable animations using splines. The bias indicates how much each velocity (initial and final) gets modified to achieve periodicity."
Bug: 292114811
Test: KeyframeSplineAnimationTest#interpolatedValues_periodic
Change-Id: Ic1e6c4996f8c25055955331384639b57e9ad86db
M compose/animation/animation-core/api/current.txt
M compose/animation/animation-core/api/restricted_current.txt
M compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/KeyframesWithSplineBuilderSample.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/KeyframeSplineAnimationTest.kt
M compose/animation/animation-core/src/androidUnitTest/kotlin/androidx/compose/animation/core/MonoSplineTest.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/MonoSpline.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedMonoSplineKeyframesSpec.kt
M compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/AnimationDemos.kt
M compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/OffsetKeyframeSplinePlaygroundDemo.kt
A compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/PeriodicMonoSplineDemo.kt
na...@google.com <na...@google.com> #8
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.animation:animation:1.7.0-alpha07
androidx.compose.animation:animation-android:1.7.0-alpha07
androidx.compose.animation:animation-core:1.7.0-alpha07
androidx.compose.animation:animation-core-android:1.7.0-alpha07
androidx.compose.animation:animation-core-desktop:1.7.0-alpha07
androidx.compose.animation:animation-desktop:1.7.0-alpha07
Description
Jetpack Compose version: 1.4.3
Jetpack Compose component used:
animateOffsetAsState
,KeyframesSpec
Android Studio Build: #IU-231.8109.175
Kotlin version: 1.8.20
This is a feature request. As described in the docs , we can specify
AnimationSpec
usingkeyframes
, which returnsKeyframesSpec
.For example:
This example animates between the specified coordinates in straight lines. It would be good to be able to enable some kind of interpolation. So that the path is smooth and curvy, instead of sharply changing the direction.
The API could look like this: