Learn creative coding writing simple programs

35. A grid of rotating objects creates a wave of rectangles

This is the second time we create a grid of objects.

In the previous episode we used a while loop inside a while loop. Those loops increased two variables which were used to place rectangles in the screen.

In this episode we use again two nested while loops, but instead of counting pixels to fill the whole screen, we count how many rectangles we want to draw. Then we use a function from previous episodes that creates rotating rectangles.

We try different things: all rectangles rotating with exactly the same angle, using a different angle for rectangles depending on the column, depending on the row, and finally we give a different rotation angle for each rectangle in the screen depending on the column, the row and a variable that constantly increases to make them spin.

Tags: rotation, grid, while, loop, spinning

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus