Learn creative coding writing simple programs

26. Make patterns by rotating objects

After many episodes moving things up, down, left and right, we introduce rotation. The rotate() function allows us to create rectangles that are not horizontal or vertical. If we make many of them using a while loop, we can create interesting patterns. For now we only rotate things around the top left corner of the screen. In future episodes we will discover how we can rotate objects around their own center (like when a CD or the wheels of a car spin).
The smooth() function makes the lines smoother, which you will notice a lot when you rotate rectangles.


Code editor

You can make changes to the code below. Then

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
  Do `float` and `int` smell similar?
To highlight code blocks, use ```processing and ``` like this:
  void setup() {
    size(600, 600);