Skip to content

Instantly share code, notes, and snippets.

@bashbaugh
Created February 26, 2019 02:11
Show Gist options
  • Save bashbaugh/5f2d93d8ad5edb457a39e894f880ba5a to your computer and use it in GitHub Desktop.
Save bashbaugh/5f2d93d8ad5edb457a39e894f880ba5a to your computer and use it in GitHub Desktop.
// Clear the canvas and draw background:
draw_background();
// there is one number in dots_x for each dot, so dots_x.length is equal to the number of dots.
// For every dot:
for (i = 0; i < dots_x.length; i++)
{
// Move dot down canvas a little:
dots_y[i] += dot_pixels_per_frame;
canvas.beginPath(); // Start drawing
canvas.arc(dots_x[i], dots_y[i], dot_radius, 0, 2*Math.PI); // Draw 360 degree arc (full circle)
canvas.fillStyle = dots_color[i]; // Set color
canvas.fill(); // Fill in circle
canvas.closePath(); // End drawing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment