xxxxxxxxxx
23
let pg;
function setup() {
createCanvas(400, 400, WEBGL);
pg = createGraphics(200, 200);
pg.background(255);
pg.noStroke();
for(var x=0; x<pg.width; x+=random(30)) {
pg.fill(random(255), 0, 0);
pg.rect(x, 50, 100, 100);
}
}
function draw() {
background(200);
beginShape();
texture(pg);
vertex(100, -200, 0, 0);
vertex(200, 0, 200, 0);
vertex(-100, 200, 200, 200);
vertex(-200, 0, 0, 200);
endShape(CLOSE);
}