File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/modifiers Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package com.example.compose.snippets.modifiers
1818
1919import android.annotation.SuppressLint
2020import androidx.compose.animation.core.Animatable
21+ import androidx.compose.animation.core.AnimationVector1D
2122import androidx.compose.animation.core.DecayAnimationSpec
2223import androidx.compose.animation.core.RepeatMode
2324import androidx.compose.animation.core.animateFloatAsState
@@ -259,14 +260,15 @@ class ScrollableNode :
259260object CustomModifierSnippets14 {
260261 // [START android_compose_custom_modifiers_14]
261262 class CircleNode (var color : Color ) : Modifier.Node(), DrawModifierNode {
262- private val alpha = Animatable ( 1f )
263+ private lateinit var alpha: Animatable < Float , AnimationVector1D >
263264
264265 override fun ContentDrawScope.draw () {
265266 drawCircle(color = color, alpha = alpha.value)
266267 drawContent()
267268 }
268269
269270 override fun onAttach () {
271+ alpha = Animatable (1f )
270272 coroutineScope.launch {
271273 alpha.animateTo(
272274 0f ,
You can’t perform that action at this time.
0 commit comments