-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.2.2
Web browser and version
All
Operating system
All
Steps to reproduce this
Steps:
- Go to https://beta.p5js.org/reference/p5/buildfiltershader/
- Scroll to the fifth example, with the animated red-blue gradient
- Replace
mixwithlerp - The sketch stops working
mix and lerp should act like aliases in p5.strands. mix does already work, but lerp does not for some reason, although I thought we aliased it already? It may have gotten lost in a refactor at some point.
Snippet:
let myFilter;
function setup() {
createCanvas(50, 50, WEBGL);
myFilter = buildFilterShader(gradient);
describe('A moving, repeating gradient from red to blue');
}
function gradient() {
let time = uniformFloat();
filterColor.begin();
filterColor.set(lerp(
[1, 0, 0, 1], // Red
[0, 0, 1, 1], // Blue
sin(filterColor.texCoord.x*15 + time*0.004)/2+0.5
));
filterColor.end();
}
function draw() {
myFilter.setUniform('time', millis());
filter(myFilter);
}Reactions are currently unavailable