Skip to content

Commit d27fde2

Browse files
committed
fix bug where sparks were visible on unchecked button
1 parent 6867d47 commit d27fde2

File tree

1 file changed

+5
-6
lines changed
  • sparkbutton-compose/src/main/kotlin/at/connyduck/sparkbutton/compose

1 file changed

+5
-6
lines changed

sparkbutton-compose/src/main/kotlin/at/connyduck/sparkbutton/compose/SparkButton.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public fun SparkButton(
9999
}
100100

101101
LaunchedEffect(buttonClicks) {
102+
dotsRadiusProgress.snapTo(0.0f)
103+
102104
if (checked && buttonClicks > 0) {
103105
launch {
104106
contentScale.snapTo(0.0f)
@@ -117,8 +119,7 @@ public fun SparkButton(
117119
launch {
118120
dotsRadiusProgress.animateTo(
119121
targetValue = 1.0f,
120-
animationSpec =
121-
keyframes {
122+
animationSpec = keyframes {
122123
0f at 0 using FastOutSlowInEasing
123124
0.9f at (750 / animationSpeed).toInt() using SlowOutFastInEasing
124125
1.0f at (1000 / animationSpeed).toInt()
@@ -131,8 +132,7 @@ public fun SparkButton(
131132
launch {
132133
largeDotSizeProgress.animateTo(
133134
targetValue = 0f,
134-
animationSpec =
135-
keyframes {
135+
animationSpec = keyframes {
136136
0f at 0 using FastOutSlowInEasing
137137
1f at (450 / animationSpeed).toInt()
138138
1f at (650 / animationSpeed).toInt() using SlowOutFastInEasing
@@ -145,8 +145,7 @@ public fun SparkButton(
145145
launch {
146146
smallDotSizeProgress.animateTo(
147147
targetValue = 0f,
148-
animationSpec =
149-
keyframes {
148+
animationSpec = keyframes {
150149
0f at 0 using FastOutSlowInEasing
151150
1f at (500 / animationSpeed).toInt() using SlowOutFastInEasing
152151
0.0f at (1000 / animationSpeed).toInt()

0 commit comments

Comments
 (0)