Spiral

Spiral

This code uses a for loop to go around a circle 100 times, incrementing by .1 degrees. In other words, it takes 360,000 steps to go around the cirlce 100 times! (That means it might take a little bit until you see anything when you run the code.)

Each iteration of the loop, the code uses the cos() and sin() functions to figure out where in the spiral it is. It then chooses a color and draws a point, and then increases the distance before it repeats. Increasing the distance causes the point to spiral out from the center.

For you to try:

  • Copy and paste this code into processing, run the program and check what it does.

  • Try:

    • Change how much the distance increases. What happens if you make this value larger or smaller?

    • Change the start point, or make multiple spirals.

    • Change the colors so the spiral is black and white, or a shade of blue, etc.