Skip to content

Commit 13cf09d

Browse files
authored
Merge branch 'dev-2.0' into fix/obj-negative-indices-2.0
2 parents 3d1f4d6 + 716ec27 commit 13cf09d

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"test/**/*.js": "eslint",
2121
"utils/**/*.{js,mjs}": "eslint"
2222
},
23-
"version": "2.2.1-rc.0",
23+
"version": "2.2.1",
2424
"dependencies": {
2525
"@davepagurek/bezier-path": "^0.0.7",
2626
"@japont/unicode-range": "^1.0.0",

src/core/friendly_errors/sketch_verifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const verifierUtils = {
8080

8181
try {
8282
const ast = parse(code, {
83-
ecmaVersion: 2021,
83+
ecmaVersion: 'latest',
8484
sourceType: 'module',
8585
locations: true // This helps us get the line number.
8686
});

src/webgl/material.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,40 @@ function material(p5, fn) {
684684
* }
685685
* ```
686686
*
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.
688+
*
689+
* ```js example
690+
* let myFilter;
691+
*
692+
* function setup() {
693+
* createCanvas(100, 100, WEBGL);
694+
* myFilter = buildFilterShader(noiseShaderCallback);
695+
* 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+
*
687721
* Like the `modify()` method on shaders,
688722
* 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>
689723
* instead of JavaScript.
@@ -1633,7 +1667,7 @@ function material(p5, fn) {
16331667
/**
16341668
* Returns the base shader used for filters.
16351669
*
1636-
* Calling <a href="#/p5/buildMaterialShader">`buildFilterShader(shaderFunction)`</a>
1670+
* Calling <a href="#/p5/buildFilterShader">`buildFilterShader(shaderFunction)`</a>
16371671
* is equivalent to calling `baseFilterShader().modify(shaderFunction)`.
16381672
*
16391673
* Read <a href="#/p5/buildFilterShader">the `buildFilterShader` reference</a> or

0 commit comments

Comments
 (0)