xxxxxxxxxx
29
let c1, c2;
let pg;
function setup() {
createCanvas(windowWidth, windowHeight);
pg = createGraphics(windowWidth, windowHeight);
c1 = color(255);
c2 = color(63, 191, 191);
for (let y = 0; y < height; y++) {
n = map(y, 0, height, 0, 1);
let newc = lerpColor(c1, c2, n);
stroke(newc);
line(0, y, width, y);
}
}
function draw() {
pg.clear();
pg.fill(255, 0, 0);
pg.ellipse(150, 150, 200, 200);
pg.erase();
pg.rect(160, 160, 20, 20);
pg.rect(180, 180, 50, 50);
pg.noErase();
image(pg, 0, 0);
}