xxxxxxxxxx
30
let exampleShader;
const spd = 0.005;
let t = 0;
function preload() {
// load in the shader
exampleShader = loadShader('example.vert', 'example.frag');
}
function setup() {
createCanvas(640, 360);
noStroke();
}
function draw() {
// t = sin(frameCount/50)/2 + 0.5;
t = mouseX/width;
if(t < 0.5) {
background(255, 128, 0);
} else {
background(0, 255, 255);
}
exampleShader.setUniform("t", t);
filterShader(exampleShader);
}