1
- let myShader ;
2
-
3
- let myShader2 ;
4
1
p5 . disableFriendlyErrors = true ;
5
2
function windowResized ( ) {
6
3
resizeCanvas ( windowWidth , windowHeight ) ;
7
4
}
8
- function calculateOffset ( ) {
9
- return 30 ;
10
- }
5
+
6
+ let myShader ;
11
7
12
8
function myCol ( ) {
13
9
const col = ( sin ( millis ( ) * 0.001 ) + 1 ) / 2 ;
@@ -16,25 +12,42 @@ function myCol() {
16
12
17
13
function setup ( ) {
18
14
createCanvas ( windowWidth , windowHeight , WEBGL ) ;
19
-
20
15
myShader = baseMaterialShader ( ) . modify ( ( ) => {
21
-
22
- const offset = uniformFloat ( 1 ) ;
23
-
16
+ const time = uniformFloat ( ( ) => sin ( millis ( ) * 0.001 ) ) ;
24
17
getFinalColor ( ( col ) => {
25
- let a = createVector4 ( 1 , 2 , 3 , 4 ) ;
26
- let b = createVector4 ( 3 , 4 , 5 , 6 ) ;
27
- a = ( a * b + offset ) / 10 ;
28
- col += a ;
18
+ col . x = uvCoords ( ) . x ;
19
+ col . y = uvCoords ( ) . y ;
29
20
return col ;
30
21
} ) ;
31
- // getWorldInputs((Inputs) => {
32
- // console.log(Inputs)
33
- // })
34
- } , { parser : true , srcLocations : true } ) ;
22
+ getWorldInputs ( ( inputs ) => {
23
+ inputs . position . x += time * inputs . position . y ;
24
+ return inputs ;
25
+ } )
26
+ } , { parser : true , srcLocations : false } ) ;
35
27
}
36
28
37
29
function draw ( ) {
38
- // Set the styles
39
- background ( 0 )
30
+ orbitControl ( ) ;
31
+ background ( 0 ) ;
32
+ shader ( myShader ) ;
33
+ noStroke ( ) ;
34
+ fill ( 255 , 0 , 0 )
35
+ sphere ( 100 ) ;
40
36
}
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