@@ -50,6 +50,7 @@ import androidx.compose.animation.core.createChildTransition
50
50
import androidx.compose.animation.core.infiniteRepeatable
51
51
import androidx.compose.animation.core.keyframes
52
52
import androidx.compose.animation.core.rememberInfiniteTransition
53
+ import androidx.compose.animation.core.rememberTransition
53
54
import androidx.compose.animation.core.repeatable
54
55
import androidx.compose.animation.core.snap
55
56
import androidx.compose.animation.core.spring
@@ -65,7 +66,7 @@ import androidx.compose.animation.graphics.vector.AnimatedImageVector
65
66
import androidx.compose.animation.shrinkVertically
66
67
import androidx.compose.animation.slideInVertically
67
68
import androidx.compose.animation.slideOutVertically
68
- import androidx.compose.animation.with
69
+ import androidx.compose.animation.togetherWith
69
70
import androidx.compose.foundation.BorderStroke
70
71
import androidx.compose.foundation.Image
71
72
import androidx.compose.foundation.background
@@ -190,7 +191,6 @@ private fun AnimatedVisibilityMutable() {
190
191
// [END android_compose_animations_animated_visibility_mutable]
191
192
}
192
193
193
- @OptIn(ExperimentalAnimationApi ::class )
194
194
@Composable
195
195
@Preview
196
196
private fun AnimatedVisibilityAnimateEnterExitChildren () {
@@ -222,7 +222,6 @@ private fun AnimatedVisibilityAnimateEnterExitChildren() {
222
222
// [END android_compose_animations_animated_visibility_animate_enter_exit_children]
223
223
}
224
224
225
- @OptIn(ExperimentalAnimationApi ::class )
226
225
@Preview
227
226
@Composable
228
227
private fun AnimatedVisibilityTransition () {
@@ -259,7 +258,6 @@ private fun AnimateAsStateSimple() {
259
258
// [END android_compose_animations_animate_as_state]
260
259
}
261
260
262
- @OptIn(ExperimentalAnimationApi ::class )
263
261
@Preview
264
262
@Composable
265
263
private fun AnimatedContentSimple () {
@@ -277,7 +275,6 @@ private fun AnimatedContentSimple() {
277
275
// [END android_compose_animations_animated_content_simple]
278
276
}
279
277
280
- @OptIn(ExperimentalAnimationApi ::class )
281
278
@Composable
282
279
private fun AnimatedContentTransitionSpec (count : Int ) {
283
280
// [START android_compose_animations_animated_content_transition_spec]
@@ -288,12 +285,12 @@ private fun AnimatedContentTransitionSpec(count: Int) {
288
285
if (targetState > initialState) {
289
286
// If the target number is larger, it slides up and fades in
290
287
// while the initial (smaller) number slides up and fades out.
291
- slideInVertically { height -> height } + fadeIn() with
288
+ slideInVertically { height -> height } + fadeIn() togetherWith
292
289
slideOutVertically { height -> - height } + fadeOut()
293
290
} else {
294
291
// If the target number is smaller, it slides down and fades in
295
292
// while the initial number slides down and fades out.
296
- slideInVertically { height -> - height } + fadeIn() with
293
+ slideInVertically { height -> - height } + fadeIn() togetherWith
297
294
slideOutVertically { height -> height } + fadeOut()
298
295
}.using(
299
296
// Disable clipping since the faded slide-in/out should
@@ -318,7 +315,7 @@ private fun AnimatedContentSizeTransform() {
318
315
AnimatedContent (
319
316
targetState = expanded,
320
317
transitionSpec = {
321
- fadeIn(animationSpec = tween(150 , 150 )) with
318
+ fadeIn(animationSpec = tween(150 , 150 )) togetherWith
322
319
fadeOut(animationSpec = tween(150 )) using
323
320
SizeTransform { initialSize, targetSize ->
324
321
if (targetState) {
@@ -431,7 +428,7 @@ private object UpdateTransitionEnumState {
431
428
// Start in collapsed state and immediately animate to expanded
432
429
var currentState = remember { MutableTransitionState (BoxState .Collapsed ) }
433
430
currentState.targetState = BoxState .Expanded
434
- val transition = updateTransition (currentState, label = " box state" )
431
+ val transition = rememberTransition (currentState, label = " box state" )
435
432
// ……
436
433
// [END android_compose_animations_transitions_state]
437
434
}
@@ -663,8 +660,8 @@ private fun AnimationSpecKeyframe() {
663
660
targetValue = 1f ,
664
661
animationSpec = keyframes {
665
662
durationMillis = 375
666
- 0.0f at 0 with LinearOutSlowInEasing // for 0-15 ms
667
- 0.2f at 15 with FastOutLinearInEasing // for 15-75 ms
663
+ 0.0f at 0 using LinearOutSlowInEasing // for 0-15 ms
664
+ 0.2f at 15 using FastOutLinearInEasing // for 15-75 ms
668
665
0.4f at 75 // ms
669
666
0.4f at 225 // ms
670
667
}
0 commit comments