xxxxxxxxxx
36
let theShader;
function preload(){
// load the shader
theShader = loadShader('shader.vert', 'shader.frag');
}
function setup() {
createCanvas(400, 400, WEBGL);
noStroke();
}
function draw() {
// set curr shader
shader(theShader);
// set uniforms
theShader.setUniform('u_resolution', [width, height]);
theShader.setUniform('u_time', millis()/1000);
// idfk why everything has to be multiplied by 3 maybe something to do
// with that shader.vert thing but i give up for today bye
theShader.setUniform('mouseX', mouseX*3);
theShader.setUniform('mouseY', map(mouseY*3, 0, height*3, height*3, 0));
// draw shader onto rectangle (???)
rect(0,0,width,height);
}