TIME 2 PARTY!
sketch
// Zoe Lin (ID: youlin)
// Section B
var x, y, r, g, b, rad;
function setup() {
createCanvas(500, 500);
noStroke();
rectMode(CENTER);
}
function draw() {
background(random(0, 15));
//party lights!!!
push();
blendMode(SCREEN);
r = random(255); //randomizes color
g = random(50);
b = random(255);
x = random(width); //randomizes where lights spawn
y = random(height);
rad = random(2, 50); //randomizes size of circle
noStroke();
fill(r, g, b, random(75, 125)); //sets a random transparency
circle(x, y, rad); //spawns a circle anywhere on canvas
circle(mouseX, mouseY, rad*2); //spawns lights where the cursor is
pop();
let r1 = map(mouseX, 0, height/2, 0, width/2); //tracks horizontal location of mouse
let r2 = width - r1;
let up = map(mouseY, 0, height, 0, width); // tracks vertical location of mouse
let down = height - up; //the other way
//circle1
let circle1X = width / 3 + r2 * 0.75 //x position of circle 1
let circle1Y = height / 3 - r2 / 3.5 //y position of circle 1
let circle1Mouth = up/4 //mouth location of circle 1
//body
noStroke();
fill(up/3,r1/3,down/3,r2/3);
ellipse(circle1X, circle1Y, down, r2); //fluid body
//eye
fill(0, r2);
circle(circle1X - up/4, circle1Y - r2/10 , down/20);
//eye
fill(0, r2);
circle(circle1X + up/4, circle1Y - r2/10 , up/12);
//mouth
noFill();
stroke(0, r2);
strokeWeight(4);
arc(circle1X, circle1Y + r2/12, circle1Mouth, circle1Mouth, TWO_PI, PI);
//circle2
let circle2X = width / 2
let circle2Y = height / 2 + down / 2
let circle2Mouth = down/4
noStroke();
fill(r2/3,up/3,r1/3,down/3);
ellipse(circle2X, circle2Y, down*1.25, up*1.5);
fill(0, r2)
circle(circle2X - r2/4, circle2Y - down/10 , up/8);
fill(0, r2)
circle(circle2X + r2/4, circle2Y - down/10 , down/8);
noFill();
stroke(0, r2);
strokeWeight(4);
arc(circle2X, circle2Y + r2/20, circle2Mouth, circle2Mouth, TWO_PI, PI);
//circle3
let circle3X = width / 1.5 + r2 / 2
let circle3Y = height / 2
let circle3Mouth = down/10
noStroke();
fill(down/3,r2/3,up/3,r1/3);
ellipse(circle3X, circle3Y, r2*1.5, r2*1.5);
fill(0, r2)
circle(circle3X - r2/4, circle3Y - r2/10 , r2/8);
fill(0, r2)
circle(circle3X + r2/4, circle3Y - up/10 , r2/8);
noFill();
stroke(0,r2 );
strokeWeight(4);
arc(circle3X, circle3Y + r2/12, circle3Mouth, circle3Mouth, TWO_PI, PI);
//circle4
let circle4X = width / 1.5 - r1/1.7
let circle4Y = height / 4 + r2/4
let circle4Mouth = down/10
noStroke();
fill(r1/3,down/3,r2/3,up/2.5);
ellipse(circle4X, circle4Y, r1*1.25, down);
fill(0, r2)
circle(circle4X - r1/4, circle4Y - r2/15 , r1/8);
fill(0, r2)
circle(circle4X + r1/4, circle4Y - r1/10 , r1/8);
noFill();
stroke(0,r2);
strokeWeight(4);
arc(circle4X, circle4Y + r1/10, circle4Mouth, circle4Mouth, TWO_PI, PI);
//circle5
let circle5X = width / 3 - r2 / 1.5
let circle5Y = height / 2.5
let circle5Mouth = r2/4
noStroke();
fill(down/3,r2/2,r1/2,r2/3);
ellipse(circle5X/1.5, circle5Y/2, up, up*1.25);
fill(0, r2)
circle(circle5X - up/4, circle5Y - up/3 , r1/8);
fill(0, r2)
circle(circle5X + r1/4, circle5Y - r1/3 , r1/8);
noFill();
stroke(0,r2);
strokeWeight(4);
arc(circle5X, circle5Y + r1/20, circle5Mouth, circle5Mouth, TWO_PI, PI);
//circle6
let circle6X = width / 5 + r1 / 2.5
let circle6Y = height - 10
let circle6Mouth = r1/5
noStroke();
fill(r2/3,up/4,r2/2,up/3);
ellipse(circle6X, circle6Y, up*0.6, down*1.2);
fill(0, r2)
circle(circle6X - up/5, circle6Y - up/10 , r1/10);
fill(0, r2)
circle(circle6X + r1/7, circle6Y - r1/10 , r1/10);
noFill();
stroke(0,r2);
strokeWeight(4);
arc(circle6X, circle6Y + r1/10, circle6Mouth, circle6Mouth, TWO_PI, PI);
//circ7
let circle7X = width - 10
let circle7Y = height / 2 - up
let circle7Mouth = up/4
noStroke();
fill(up/3,r1/4,down/2,r2/3);
ellipse(circle7X, circle7Y, down*0.5, up);
fill(0, r2)
circle(circle7X - up/4, circle7Y - up/10, r1/8);
fill(0, r2)
circle(circle7X + r1/4, circle7Y - r1/10 , r1/8);
noFill();
stroke(0,r2);
strokeWeight(4);
arc(circle7X, circle7Y+r1/20, circle7Mouth, circle7Mouth, TWO_PI, PI);
}