Games from Nothing: Black & White Exercise #3 — Amusement Park

sketch1

For this exercise I chose to make a rotation-based ‘ride’ that spins, but also modulates the shape of the ride itself. I envisioned something that started with one shape and morphed to another shape while spinning. I wanted to create diversity of movement, and I also wanted to play with forced-perspective.  The code is very simple

float angle = 0.0;
float radius = 0.0;
float change = 1;

void setup() {
// orientation(LANDSCAPE);
size(1024,768);
}

void draw() {

//I decided to make two different ‘centers’ with two different rotating systems
translate(mouseX+300, mouseY);
rotate(angle);
rect(0, 0, radius, radius, radius);
angle += 0.1;
if(radius>150) change *= -1;

if(radius<-150) change *= -1;
radius += change;

//here is the second ‘system’
translate(mouseX-300, mouseY);

rotate(angle);
rect(0, 0, radius, radius, radius);
angle += 0.1;
if(radius>150) change *= -1;
if(radius<-150) change *= -1;
radius += change;
}

sketch2

As the ‘radius’ float changes between 150 and -150, the shape changes wildly since it is also changing the radius of the corners of the rectangle. Once the radius becomes negative, the corners invert and it looks like this ^^^. I might not want to ride this ride, because you would clearly get transported to another dimension, BUT if there’s Pizza and Beer on the other side it could be worth it.

Author: Jonathan Lloyd