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
18
18
19
19
import android.annotation.SuppressLint
20
20
import androidx.compose.animation.core.Animatable
21
+ import androidx.compose.animation.core.AnimationVector1D
21
22
import androidx.compose.animation.core.DecayAnimationSpec
22
23
import androidx.compose.animation.core.RepeatMode
23
24
import androidx.compose.animation.core.animateFloatAsState
@@ -259,14 +260,15 @@ class ScrollableNode :
259
260
object CustomModifierSnippets14 {
260
261
// [START android_compose_custom_modifiers_14]
261
262
class CircleNode (var color : Color ) : Modifier.Node(), DrawModifierNode {
262
- private val alpha = Animatable ( 1f )
263
+ private lateinit var alpha: Animatable < Float , AnimationVector1D >
263
264
264
265
override fun ContentDrawScope.draw () {
265
266
drawCircle(color = color, alpha = alpha.value)
266
267
drawContent()
267
268
}
268
269
269
270
override fun onAttach () {
271
+ alpha = Animatable (1f )
270
272
coroutineScope.launch {
271
273
alpha.animateTo(
272
274
0f ,
You can’t perform that action at this time.
0 commit comments