Creating Motion Trails | KIRUPA

by kirupa | 15 March 2016

Have you ever seen a comet or a meteor streaking across the sky? It looks something like this:

This is a companion discussion topic for the original entry at

Hi there,
First off: congrats, you are just very very good at teaching stuff.
Following on the motion trails post.
The motion trail is never continuous and linear but rather gapy as if the previous positions were drawn every some pixels.
How do i get a continuous line? Thanks lot

Are you trying to re-create something similar to a pen going across the screen? :slight_smile:

Correct, how do I do that?

Apologies for the delay. If you clear this line, your previous lines will still remain:

context.clearRect(0, 0, canvas.width, canvas.height);

You can play with this to selectively redraw only parts of your UI while keeping the other parts static :slight_smile:

Hello, how can i force particle to move using not-random, but defined inside array/json file directions? Like i have many points on canvas starting from 0,0 and my particle should move to 100,100 then 200,300 then 66,66 in order ?

Sorry for missing this earlier. Do you need it to move through those same points all the time, or will the points change at any point?