Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.example.compose.snippets.modifiers

import android.annotation.SuppressLint
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.DecayAnimationSpec
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloatAsState
Expand Down Expand Up @@ -259,14 +260,15 @@ class ScrollableNode :
object CustomModifierSnippets14 {
// [START android_compose_custom_modifiers_14]
class CircleNode(var color: Color) : Modifier.Node(), DrawModifierNode {
private val alpha = Animatable(1f)
private lateinit var alpha: Animatable<Float, AnimationVector1D>

override fun ContentDrawScope.draw() {
drawCircle(color = color, alpha = alpha.value)
drawContent()
}

override fun onAttach() {
alpha = Animatable(1f)
coroutineScope.launch {
alpha.animateTo(
0f,
Expand Down