Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 85cf74c

Browse files
update Tutorial6_9_1NeonEffect
1 parent 34541ca commit 85cf74c

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

‎Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/chapter6_graphics/Tutorial6_9_1NeonEffect.kt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ private fun NeonDrawingSample() {
187187
// This is previous motion event before next touch is saved into this current position
188188
var previousPosition by remember { mutableStateOf(Offset.Unspecified) }
189189

190-
191190
val transition: InfiniteTransition = rememberInfiniteTransition()
192191

193192
// Infinite phase animation for PathEffect
@@ -218,17 +217,18 @@ private fun NeonDrawingSample() {
218217

219218
this.color = transparent
220219
}
220+
221+
asFrameworkPaint().setShadowLayer(
222+
35f * phase,
223+
0f,
224+
0f,
225+
color
226+
.copy(alpha = phase)
227+
.toArgb()
228+
)
221229
}
222230
}
223231

224-
paint.asFrameworkPaint().setShadowLayer(
225-
35f * phase,
226-
0f,
227-
0f,
228-
color
229-
.copy(alpha = phase)
230-
.toArgb()
231-
)
232232

233233
// Path is what is used for drawing line on Canvas
234234
val path = remember { Path() }
@@ -263,7 +263,7 @@ private fun NeonDrawingSample() {
263263
}
264264

265265
MotionEvent.Move -> {
266-
path.quadraticBezierTo(
266+
path.quadraticTo(
267267
previousPosition.x,
268268
previousPosition.y,
269269
(previousPosition.x + currentPosition.x) / 2,
@@ -296,4 +296,3 @@ private fun NeonDrawingSample() {
296296
}
297297
}
298298
}
299-

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /