xxxxxxxxxx
33
// The Coding Train / Daniel Shiffman
// Video: https://youtu.be/3tTZlTq4Cxs
let angle = 0;
let graphics;
function setup() {
createCanvas(400, 300, WEBGL);
graphics = createGraphics(300, 300);
graphics.background(255);
}
function draw() {
background(0);
// Add noStroke() to eliminate the wireframe
noStroke();
lights();
graphics.fill(255, 0, 255);
graphics.ellipse(mouseX, mouseY, 20);
//ambientLight(255);
//directionalLight(255, 255, 255, 0, 0, 1);
rotateX(angle);
rotateY(angle * 1.3);
rotateZ(angle * 0.7);
texture(graphics);
box(100);
angle += 0.03;
}