File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/lists Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ package com.example.compose.snippets.lists
20
20
21
21
import androidx.compose.animation.AnimatedVisibility
22
22
import androidx.compose.animation.ExperimentalAnimationApi
23
+ import androidx.compose.animation.core.Spring
24
+ import androidx.compose.animation.core.spring
23
25
import androidx.compose.animation.core.tween
24
26
import androidx.compose.foundation.ExperimentalFoundationApi
25
27
import androidx.compose.foundation.horizontalScroll
@@ -434,7 +436,7 @@ private fun LazyItemAnimations() {
434
436
// [START android_compose_layouts_lazy_column_item_animation]
435
437
LazyColumn {
436
438
items(books, key = { it.id }) {
437
- Row (Modifier .animateItemPlacement ()) {
439
+ Row (Modifier .animateItem ()) {
438
440
// ...
439
441
}
440
442
}
@@ -452,8 +454,10 @@ private fun LazyItemAnimationWithSpec() {
452
454
LazyColumn {
453
455
items(books, key = { it.id }) {
454
456
Row (
455
- Modifier .animateItemPlacement(
456
- tween(durationMillis = 250 )
457
+ Modifier .animateItem(
458
+ fadeInSpec = tween(durationMillis = 250 ),
459
+ fadeOutSpec = tween(durationMillis = 100 ),
460
+ placementSpec = spring(stiffness = Spring .StiffnessLow , dampingRatio = Spring .DampingRatioMediumBouncy )
457
461
)
458
462
) {
459
463
// ...
You can’t perform that action at this time.
0 commit comments