xxxxxxxxxx
31
p5.disableFriendlyErrors = true;
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
let myShader;
function myCol() {
const col = (sin(millis() * 0.001) + 1)/2;
return col;
}
function setup(){
createCanvas(windowWidth, windowHeight, WEBGL);
myShader = baseMaterialShader().modify(() => {
const greenValue = uniformFloat(() => myCol());
getFinalColor((col) => {
col.x = 1
col.y = greenValue;
return col;
});
}, { parser: true, srcLocations: false });
}
function draw(){
background(0);
shader(myShader);
fill(0,0,0)
sphere(100);
}