Skip to content

Commit 9932797

Browse files
committed
sketch example
1 parent 435a718 commit 9932797

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

preview/global/sketch.js

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,26 @@ p5.disableFriendlyErrors = true;
22
function windowResized() {
33
resizeCanvas(windowWidth, windowHeight);
44
}
5-
65
let myShader;
76

8-
function myCol() {
9-
const col = (sin(millis() * 0.001) + 1)/2;
10-
return col;
11-
}
12-
137
function setup(){
148
createCanvas(windowWidth, windowHeight, WEBGL);
9+
1510
myShader = baseMaterialShader().modify(() => {
16-
const time = uniformFloat(() => sin(millis()*0.001));
11+
const time = uniformFloat(() => millis());
12+
1713
getFinalColor((col) => {
1814
col.x = uvCoords().x;
1915
col.y = uvCoords().y;
16+
col.z = 1;
2017
return col;
2118
});
19+
2220
getWorldInputs((inputs) => {
23-
inputs.position.x += time * inputs.position.y;
21+
inputs.position.y += 20 * sin(time * 0.001 + inputs.position.x * 0.05);
2422
return inputs;
2523
})
26-
}, { parser: true, srcLocations: false });
24+
});
2725
}
2826

2927
function draw(){
@@ -34,20 +32,3 @@ function draw(){
3432
fill(255,0,0)
3533
sphere(100);
3634
}
37-
38-
// `(vec4 color) {
39-
// // From at <computed> [as uniformVector4] (http://localhost:5173/p5.js:86002:25)
40-
// vec4 temp_0 = uCol;
41-
// temp_0 = vec4(temp_0.x, 1.0000, temp_0.z, temp_0.w);
42-
// vec4 finalReturnValue = temp_0;
43-
// return finalReturnValue;
44-
// }`
45-
// `
46-
// (vec4 color) {
47-
48-
// // From at <computed> [as uniformVector4] (http://localhost:5173/p5.js:86002:25)
49-
// vec4 temp_0 = uCol;
50-
// temp_0 = vec4(temp_0.x, 1.0000, temp_0.z, temp_0.w);
51-
// vec4 finalReturnValue = temp_0 + vec4(0.0000 + 2.0000, 0.0000, 0.0000, 0.0000);
52-
// return finalReturnValue;
53-
// }`

0 commit comments

Comments
 (0)