Random shapes and colors in each quadrant. Center circle shows the color pallet of the shapes.
//Raymond Pai
//Section D
//rpai@andrew.cmu.edu
//Project-03
var angle = 0;
var r = 200
var g = 200
var b = 200
function setup() {
createCanvas(600, 600);
background(0);
}
function draw() {
//Q1
if (mouseX > 300 & mouseY < 300){
r = random(100, 200);
g = random(200, 300);
b = random(0, 105);
fill(r, g, b); // control rect color explicitly
stroke(0);
strokeWeight(6);
push();
translate(mouseX, mouseY);
rotate(radians(angle));
ellipseMode(CENTER); // center rect around 0,0
ellipse(0, 0, 1000, 200);
pop();
angle = angle + 5;
}
//Q2
if (mouseX < 300 & mouseY < 300){
r = random(200, 255);
g = random(10, 25);
b = random(200, 255);
fill(r, g, b); // control rect color explicitly
stroke(0);
strokeWeight(6);
push();
translate(mouseX, mouseY);
rotate(radians(angle));
ellipseMode(CENTER); // center rect around 0,0
ellipse(0, 0, 40, 200);
pop();
angle = angle + 5;
}
//Q3
if (mouseX < 300 & mouseY > 300){
r = random(100, 255);
g = random(200, 255);
b = random(200, 255);
fill(r, g, b); // control rect color explicitly
stroke(0);
strokeWeight(6);
push();
translate(mouseX, mouseY);
rotate(radians(angle));
ellipseMode(CENTER); // center rect around 0,0
ellipse(0, 0, 300, 20);
pop();
angle = angle + 5;
}
//Q4
if (mouseX > 300 & mouseY > 300){
r = random(10, 25);
g = random(10, 250);
b = random(200, 255);
fill(r, g, b); // control rect color explicitly
stroke(0);
strokeWeight(6);
push();
translate(mouseX, mouseY);
rotate(radians(angle));
ellipseMode(CENTER); // center rect around 0,0
ellipse(0, 0, 10, 2000);
pop();
angle = angle + 5;
}
//Secret Center
if (mouseX < 600){
ellipse(300, 300, 200, 200);
}
}