You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/webgl/material.js
+13-23Lines changed: 13 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -411,7 +411,7 @@ function material(p5, fn) {
411
411
* // Make a version of the shader with a hook overridden
412
412
* modifiedShader = myShader.modify(() => {
413
413
* // Create new uniforms and override the getColor hook
414
-
* let t = uniformFloat(() => millis() / 1000);
414
+
* let t = millis() / 1000;
415
415
* getColor(() => {
416
416
* return [0, 0.5 + 0.5 * sin(t), 1, 1];
417
417
* });
@@ -657,7 +657,7 @@ function material(p5, fn) {
657
657
* }
658
658
* ```
659
659
*
660
-
* You can also animate your filters over time by passing the time into the shader with `uniformFloat`.
660
+
* You can also animate your filters over time using the `millis()` function.
661
661
*
662
662
* ```js example
663
663
* let myFilter;
@@ -668,7 +668,7 @@ function material(p5, fn) {
668
668
* }
669
669
*
670
670
* function gradient() {
671
-
* let time = uniformFloat();
671
+
* let time = millis();
672
672
* filterColor.begin();
673
673
* filterColor.set(mix(
674
674
* [1, 0, 0, 1], // Red
@@ -679,12 +679,11 @@ function material(p5, fn) {
679
679
* }
680
680
*
681
681
* function draw() {
682
-
* myFilter.setUniform('time', millis());
683
682
* filter(myFilter);
684
683
* }
685
684
* ```
686
685
*
687
-
* We can use the `noise()` function built into strands to generate a color for each pixel. (Again no need here for underlying content for the filter to operate on.) Again we'll animate by passing in an announced uniform variable `time` with `setUniform()`, each frame.
686
+
* We can use the `noise()` function built into strands to generate a color for each pixel. (Again no need here for underlying content for the filter to operate on.) Again we'll animate by using the millis() function to get an up-to-date time value.
0 commit comments