diff --git a/core/src/main/kotlin/plus/rua/project/ui/AnimatedGif.kt b/core/src/main/kotlin/plus/rua/project/ui/AnimatedGif.kt index 7f4fbb1..e102446 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/AnimatedGif.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/AnimatedGif.kt @@ -2,6 +2,8 @@ package plus.rua.project.ui import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.FastOutSlowInEasing +import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -38,13 +40,17 @@ fun AnimatedGif( ) { val webpFile = remember(seed) { WEBP_FILES.random() } val uri = remember(webpFile) { getWebpUri(webpFile) } - val alpha = remember { Animatable(0f) } + val scale = remember { Animatable(0f) } LaunchedEffect(seed) { - alpha.snapTo(0f) - alpha.animateTo( + scale.snapTo(0f) + scale.animateTo( + targetValue = 1.1f, + animationSpec = tween(250, easing = FastOutSlowInEasing), + ) + scale.animateTo( targetValue = 1f, - animationSpec = tween(150, easing = FastOutSlowInEasing), + animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy), ) } @@ -57,7 +63,9 @@ fun AnimatedGif( contentDescription = contentDescription, state = state, modifier = modifier.graphicsLayer { - this.alpha = alpha.value + scaleX = scale.value + scaleY = scale.value + alpha = scale.value.coerceIn(0f, 1f) }, ) } diff --git a/core/src/main/kotlin/plus/rua/project/ui/YearGridView.kt b/core/src/main/kotlin/plus/rua/project/ui/YearGridView.kt index 6abbcd8..a20a451 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/YearGridView.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/YearGridView.kt @@ -167,12 +167,11 @@ fun YearGridView( ) { (0 until 3).forEach { col -> val month = row * 3 + col + 1 - val isSelectedMonth = month == selectedMonth with(sharedTransitionScope) { MiniMonth( year = year, month = month, - isSelected = isSelectedMonth, + isSelected = month == selectedMonth, today = today, days = monthDays[month - 1], colors = colors, @@ -182,19 +181,13 @@ fun YearGridView( onClick = { onMonthClick(month) }, modifier = Modifier .weight(1f) - .then( - if (isSelectedMonth) { - Modifier.sharedElement( - sharedContentState = rememberSharedContentState( - key = "month_grid_${year}_$month" - ), - animatedVisibilityScope = animatedVisibilityScope, - boundsTransform = { _, _ -> - tween(400, easing = FastOutSlowInEasing) - } - ) - } else { - Modifier + .sharedElement( + sharedContentState = rememberSharedContentState( + key = "month_grid_${year}_$month" + ), + animatedVisibilityScope = animatedVisibilityScope, + boundsTransform = { _, _ -> + tween(400, easing = FastOutSlowInEasing) } ) )