File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/animations Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -280,14 +280,15 @@ private fun AnimateAsStateSimple() {
280280 // [START android_compose_animations_animate_as_state]
281281 var enabled by remember { mutableStateOf(true ) }
282282
283- val alpha : Float by animateFloatAsState(if (enabled) 1f else 0.5f , label = " alpha" )
283+ val animatedAlpha : Float by animateFloatAsState(if (enabled) 1f else 0.5f , label = " alpha" )
284284 Box (
285285 Modifier
286286 .fillMaxSize()
287- .graphicsLayer( alpha = alpha)
287+ .graphicsLayer { alpha = animatedAlpha }
288288 .background(Color .Red )
289289 )
290290 // [END android_compose_animations_animate_as_state]
291+ { Button (onClick = { enabled = ! enabled }) { Text (" Animate me!" ) } }
291292}
292293
293294@Preview
You can’t perform that action at this time.
0 commit comments