xxxxxxxxxx
39
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(255);
shader(myShader);
fill(0,0,0)
sphere(100);
}
// vec4 getFinalColor (vec4 color) {
// vec4 temp_0 = color;
// temp_0 = vec4(1.0000, temp_0.y + greenValue, temp_0.z, temp_0.w);
// vec4 finalReturnValue = temp_0;
// return finalReturnValue;
// }