canvasdevelopment

Hypnotizing stars!

This is a demo I wrote using JavaScript and the Canvas element.

Notice that a star is carved out of a circle. Given an angle, you can find the position of that point on a circle with a radius of 1. Get the x-coordinate with cosine and the y-coordinate with sine. Multiply by your desired radius. Decide how many points you want the star to have. Divide the full angle of a circle (2π) by twice the number of points. Decide on an inner and outer radius for the star, as in how far apart to make the points and how far to go back in. Now, draw lines between the points and use the magical flood fill command.

Vezquex 3 points 2 months ago

DUDE. Listen to the Infected Mushroom song while watching this. O_O VERY TRIPPY. Just do it. :D

Zoomer2 1 point 2 months ago

Nice. It is sort of hypnotic...

Tenshimaru 1 point 2 months ago

Powered by AppJet
source
rendered in 0.067s