Abdullah Musa
03/31/2025, 10:19 AMAbdullah Musa
03/31/2025, 10:22 AM// ViewModel
var elevation by mutableIntStateOf(0)
private set
// Composable
val elevation by animateIntAsState(
targetValue = viewModel.elevation,
animationSpec = tween(durationMillis = 500, easing = FastOutSlowInEasing),
label = "elevationAnimation",
)
Abdullah Musa
03/31/2025, 10:25 AMbackgroundImages.forEach {
if (elevation in it.renderRange) {
Image(...)
}
}
onatyr
03/31/2025, 1:30 PMZach Klippenstein (he/him) [MOD]
03/31/2025, 2:51 PMderivedStateOf
to calculate which range you’re in and then only read the derived state in compositionAbdullah Musa
04/01/2025, 6:26 PMval elevation by animateIntAsState(targetValue = viewModel.elevation, ...)