xxxxxxxxxx
41
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
fill(255)
let Y=100 // inc 5
let size=250 //dec 10
fill(255,0,0)
while (Y <= height && size>=0) {
if (Y % 10!=0){
fill(0,random(0,255),0)
heart(width/2, Y, size);
}
else{
fill(32,178,170)
heart(width/2, Y, size);
}
Y+=5
size-=10;
}
}
function heart(x, y, size) {
beginShape();
vertex(x, y);
bezierVertex(x - size / 2, y - size / 2, x - size, y + size / 3, x, y + size);
bezierVertex(x + size, y + size / 3, x + size / 2, y - size / 2, x, y);
endShape(CLOSE);
}