let diam=60
let direction = 1
let centX, centY
function setup() {
createCanvas(1280, 720);
stroke(115,160,210,80);
strokeWeight(5)
frameRate(2);
smooth(5);
}
function draw() {
background(225);
strokeWeight(50);
stroke(250,160,240,80);
let my=mouseY/2+120;
line(0,my,width,my);
stroke(115,160,210,80)
for(let y=0; y<=height;y+=60){
for(let x=0; x<=width; x+= 60)
{
fill(255,0,0,63);
rect(x,y,60,60);
}
}
if(mouseIsPressed){
for(let y=0;y<=height; y+=60){
for(let x=0;x<=width;x+=60){
fill(190,203,250);
stroke(1)
rect(x,y,60,60);
}
}
}
stroke(250,160,240,80)
for (let y=0;y<=height; y+=60){
for (let x=0; x<=width; x+=60){
if(diam>=60||diam<=0)
{direction *=-1;}
fill(255,0,0,63);
ellipse(x,y,diam,diam)
diam+=20*direction;
}
if(keyIsPressed)
for(let y=0;y<=height; y+=60){
for(let x=0; x<=width; x+=60){
strokeWeight(5)
stroke(250,160,240);
}
}
}
}
Comments