-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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.x
Web browser and version
All
Operating system
All
Steps to reproduce this
Steps:
- Inside a try/catch, initialize a p5.strands shader, but make a typo in your code to cause an error
- Try to draw something afterwards using a function p5.strands overrides, like
noise
Those functions won't work even after catching the error. This is because the strands context is still active and is never cleaned up, so your only real option is to reload the page. This is a problem in contexts where you're making an editor of sorts that uses p5, and user input may contain errors.
Snippet:
let sh
function setup() {
createCanvas(400, 400, WEBGL);
try {
sh = baseFilterShader().modify(() => {
getColor(() => {
thisVariableIsUndefined.something()
})
})
} catch (e) {
console.log(e)
}
}
function draw() {
background('red')
circle(100 * noise(frameCount * 0.1), 100 * noise(frameCount * 0.1), 20)
}Live: https://editor.p5js.org/davepagurek/sketches/3R8dqaSIS