xxxxxxxxxx
25
function heart(x0, y0, w) {
let xRadius = w / 2;
let ellipseDiam = xRadius * 1.25;
let ellipseOffsetX = (2 / 9) * w;
let ellipseOffsetY = (3 / 20) * w;
let triY = 1.2 * xRadius;
ellipse(x0 - ellipseOffsetX, y0 - ellipseOffsetY, ellipseDiam);
ellipse(x0 + ellipseOffsetX, y0 - ellipseOffsetY, ellipseDiam);
triangle(x0 - xRadius, y0, x0 + xRadius, y0, x0, y0 + triY);
}
function setup() {
createCanvas(windowWidth, windowHeight);
noLoop();
}
function draw() {
background(220, 10, 120);
fill(250, 190, 0);
noStroke();
heart(200, 150, 200);
}