xxxxxxxxxx
35
// toggle to false to see intended behavior
let useLayer = true;
// swap between two sketches
if (useLayer) {
let lay;
function setup() {
createCanvas(windowWidth, windowHeight);
lay = createGraphics(width*2, height*2, WEBGL);
}
function draw() {
background(0);
lay.orbitControl(5); // has no effect on layer
lay.noFill();
lay.stroke(255);
lay.box(height/2);
image(lay, 0, 0, width, height);
}
} else {
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
}
function draw() {
background(0);
orbitControl(5); // has no effect on layer
noFill();
stroke(255);
box(height/2);
}
}