How to draw luminous lines with canvas?

Press and drag the mouse, draw a glowing line with canvas, save the track, and then play the track.

implementation idea:
1 press the mouse to draw a line, record the track with an array, and then play the track
2 to shadow the line

.

question:
drawing lines, recording tracks have been realized, mainly drawing luminous lines this is a bit difficult to achieve.

the effect of the line drawn with the method in the train of thought looks stiff, without the feeling of streamer or glowing.
want to draw a glowing line, how can this be realized?

similar to Apple"s effect, but feel free to draw

![][3]

Mar.13,2022

can only give you a rough idea. The first step is to capture the coordinate values of the mouse on the canvas, put the coordinate values in an array, and draw a straight line according to the adjacent coordinates. Of course, there are a lot of details to deal with. There is a canvas course on Moshi.com that writes on the mobile side, which is roughly the same as your needs. You can find out about it. I hope it helps you.

Menu