xxxxxxxxxx
let vecLocation = [];
let vecVelocity = [];
const NUM = 12;
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(100);
for (let i = 0; i < NUM; i++) {
vecLocation[i] = createVector(width / 2, height / 2);
vecVelocity[i] = createVector(random(-12,12), random(-12,12));
}
}
function draw() {
//background
background(255,222,122);
noStroke();
fill(255,198,42);
let a = 200;
let b = 150;
for(i = 0 ;i < 6 ; i++){
circle(a,b,80);
a = a + 250
b = b }
fill(255,198,42);
let c = 100;
let d = 350;
for(i = 0; i < 7; i++){
circle(c,d,80);
c = c + 250
d = d }
fill(255,198,42);
let x = 200;
let y = 550;
for(i = 0;i < 6;i++){
circle(x,y,80);
x = x + 250
y = y }
//bubble
fill(97,48,18);
for (let i = 0; i < NUM; i++) {
ellipse(vecLocation[i].x, vecLocation[i].y, 30, 30);
vecLocation[i].add(vecVelocity[i]);
if (vecLocation[i].x > 985 || vecLocation[i].x < 815) { // OR
vecVelocity[i].x = vecVelocity[i].x * -1;
}
if (vecLocation[i].y > 625 || vecLocation[i].y < 315) { // OR
vecVelocity[i].y = vecVelocity[i].y * -1;
}
}
//cup
stroke(0)
strokeWeight(10);
line(750,300,800,650)
line(1050,300,1000,650)
line(800,650,1000,650)
//tea
fill(181,112,75,200)
quad(780,500,1020,500,1000,650,800,650)
//straw
strokeWeight(8)
fill(255,255,255,180)
rect(885,80,30,530)
strokeWeight(10);
//cap
fill(255,255,255,150)
arc(900, 300, 300, 300, PI, TWO_PI)
line(750,300,1050,300)
//tag
fill(255,199,199)
quad(765,380,1035,380,1020,500,780,500)
fill(255)
textSize(35)
text("Bubble Tea",808,455)
}