Dance Dance

dancingbox

 

What I really wanted to do was to make the box dance to a rhythm, but I kept getting an error message. I did comment out the sound code that I had at the top for you guys to look at.

 

//import processing.sound.*;
//SoundFile file;

//void setup() {
// size(640, 360);
//background(255);

//file = new SoundFile(this, “paul.mp4”);
// file.play();
//}

//void draw() {
//}

float my_num = 10;

void setup() {
size(400, 400);
background(#88F0E6);
fill(#CA9AEA);
noStroke();
smooth();
rectMode(CENTER);
}
void draw() {
background(#88F0E6);

// move the origin to a random position in the screen.
// the random position is calculated using the noise() function
translate(width * noise(my_num + 80), height * noise(my_num + 100));

// add some random rotation using noise()
rotate(10 * noise(my_num + 40));

// draw a rectangle with a random width and height, again using noise()
rect(0, 0, 200 * noise(30 + my_num), 200 * noise(my_num));

// increase the counter variable which is used in noise() calls.
my_num = my_num + 0.02;
}

One response to “Dance Dance