Polyshape is a routine that takes a circle and divides it between X number of points. So if you want a square shape, then you give it the value of 4. If you want a triangle you give it 3 (and so on). It also has a parameter for angle rotation – making it very easy to rotate the polygon as you wish.
Next we want the lines to glow and fade away. This is not done by clearing the screen completely, but rather by using an alpha mask so that we slowly erase the pixels over a period of time.
Full article: Ghost+polygon article
View the demo