Move the mouse to move the sparkler and a trail will follow. Click the sparkler to make it stop following the mouse. Hover on it again to make it start following again. Press space to change the color.
I found a project with a trail and used its code. I can't remember who made that project, but thank you to whoever made it for the code. The rest of the code I made myself.