-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
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.0.3
Web browser and version
Firefox
Operating system
MacOS
Steps to reproduce this
Steps:
- Take a p5.strands example (e.g. the first on here: https://beta.p5js.org/reference/p5/basematerialshader/)
- Change the arrow function to a
function() { ... }
The code stops working.
Snippet:
let myShader;
function setup() {
createCanvas(200, 200, WEBGL);
// Works:
// myShader = baseMaterialShader().modify(() => {
// Doesn't work:
myShader = baseMaterialShader().modify(function() {
let time = uniformFloat(() => millis());
getWorldInputs((inputs) => {
inputs.position.y +=
20 * sin(time * 0.001 + inputs.position.x * 0.05);
return inputs;
});
});
}
function draw() {
background(255);
shader(myShader);
lights();
noStroke();
fill('red');
sphere(50);
}
Live: https://editor.p5js.org/davepagurek/sketches/Xla02SjFQ