xxxxxxxxxx
50
let ang = 180;
let img;
function preload() {
// create the letter A
img = createGraphics(200, 50);
img.fill("white");
img.textSize(280);
}
function setup() {
createCanvas(400, 600, WEBGL);
angleMode(DEGREES);
}
function draw() {
background(55);
fill(30);
// top box
push();
translate(0, -100);
box(200, 200, 10);
pop();
push();
rotateX(ang);
translate(0, 100);
img.background(30);
img.text("A", 5, 80);
texture(img);
box(200, 200, 5);
if (ang >= 0) {
ang -= 1;
} else {
ang = 180;
}
pop();
// bottom box
push();
translate(0, 100);
box(200, 200, 10);
pop();
}