Mouse position determines light position. Click and drag/mouse wheel to rotate and zoom.
xxxxxxxxxx
function flagShaderSketch(p) {
let shader;
p.setup = function() {
p.createCanvas(p.windowWidth, p.windowHeight, p.WEBGL);
// console.log(`creating shader:\nVert: ${vert}\n Frag:\n${frag}`);
shader = p.createShader(vert, frag);
p.noStroke();
p.shader(shader);
};
p.draw = function() {
p.background('white');
p.orbitControl(4, 2, 0.1);
p.pointLight(255, 255, 255, p.mouseX - p.width / 2, p.mouseY - p.height / 2, 50);
shader.setUniform("time", p.millis());
p.plane(200, 200, 10, 10);
};
}
flagShaderSketch(window);