xxxxxxxxxx
63
let shapes1
let shapes2
let nrBug = 0
function preload() {
// Inter 600
font = loadFont('https://fonts.gstatic.com/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuGKYMZhrib2Bg-4.ttf')
}
function setup() {
createCanvas(400, 400, WEBGL);
noStroke()
// First BUG
beginGeometry()
fill(255,255,255,150) // 150 opacity, it should go to black but stays on white
push();
rect(-50,-50,100,100);
pop();
fill(255,0,0,40) // 50 opacity, it should go to black but goes to white
push();
rect(0,0,100,100);
pop();
shapes1 = endGeometry()
// Second BUG
beginGeometry()
fill(255,0,0) // Fill Red
push();
rect(-50,-50,100,100);
pop();
//fill(0,255,0) // We remove the second fill(), and the first one doesn't work. If we activate it, it works again
push();
rect(0,0,100,100);
pop();
shapes2 = endGeometry()
}
function draw() {
textFont(font)
textSize(40)
background(0);
// Bug 1
if (nrBug == 0) {
model(shapes1)
text('BUG 1', -100, -100)
}
// Bug 2
if (nrBug == 1) {
model(shapes2)
text('BUG 2', -100, -100)
}
}
function mouseClicked() {
if (nrBug == 0) {nrBug = 1} else {nrBug = 0}
}