/*
Bo Yang
Section A
byang2@andrew.cmu.edu
Project-03-Dynamic-Drawing
*/
var angle1 = 0;
var angle2 = 0;
var angle3 = 0;
var angle4 = 0;
var position = 0;
function setup() {
createCanvas(600, 600);
}
function draw() {
//background changes color from black to white
background(mouseX, mouseY);
noStroke(0);
//rotating rectangle
push();
translate(200, 200);
rotate(radians(angle2));
fill(200, mouseX, mouseY);
rectMode(CENTER);
rect(0, 0, mouseX, mouseY - 20);
pop();
angle2 = angle2 + 5;
//rotating rectangle
push();
translate(180, 180);
rotate(radians(angle3));
fill(mouseX, mouseY, 255);
rect(0, 0, mouseX + 20, mouseY);
pop();
angle3 = angle3 + 15;
//rotating black ellipse
push();
translate(width / 2, height / 2);
rotate(radians(angle4));
fill(0);
ellipse(0, 0, mouseX, mouseY);
pop();
angle4 = angle4 + 30;
//rotating ellipse
push();
translate(width - 50, height - 50);
rotate(radians(angle1));
fill(random(0, 255), random(0, 255), random(0, 255));
ellipseMode(CORNER);
ellipse(position, 0, mouseX, mouseY);
pop();
position = position + 1;
angle1 = angle1 + 10;
}
This is my Dynamic Drawing. To be fancy, I make them all can change colors. The background can change colors from black to white when you moving your mouse. And the two rectangles also can change color, one is blue, the other is red. And also, when you moving your mouse, it can also change size. The two ellipses, one is black and cannot change color. The other one can change all the colors by itself.