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
FES.userError('type error',`You have returned a vector with ${receivedType.dimension} components in ${hookName} when a ${expectedType.baseType+expectedType.dimension} was expected!`);
Copy file name to clipboardExpand all lines: src/webgl/material.js
+35-1Lines changed: 35 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -684,6 +684,40 @@ function material(p5, fn) {
684
684
* }
685
685
* ```
686
686
*
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.
* describe('Evolving animated cloud-like noise in cyan and magenta');
696
+
* }
697
+
*
698
+
* function noiseShaderCallback() {
699
+
* let time = uniformFloat();
700
+
* filterColor.begin();
701
+
* let coord = filterColor.texCoord;
702
+
*
703
+
* //generate a value roughly between 0 and 1
704
+
* let noiseVal = noise(coord.x, coord.y, time / 2000);
705
+
*
706
+
* let result = mix(
707
+
* [1, 0, 1, 1], // Magenta
708
+
* [0, 1, 1, 1], // Cyan
709
+
* noiseVal
710
+
* );
711
+
* filterColor.set(result);
712
+
* filterColor.end();
713
+
* }
714
+
*
715
+
* function draw() {
716
+
* myFilter.setUniform("time", millis());
717
+
* filter(myFilter);
718
+
* }
719
+
* ```
720
+
*
687
721
* Like the `modify()` method on shaders,
688
722
* advanced users can also fill in `filterColor` using <a href="https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_on_the_web/GLSL_Shaders" target="_blank">GLSL</a>
0 commit comments