[p5.js 2.0 Bug Report]: [p5.strands] Ternary statements not supported?
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.3-rc.0
Web browser and version
n/a
Operating system
n/a
Steps to reproduce this
Steps:
- Visit this sketch: https://editor.p5js.org/neill0/sketches/ZbQ9dFk7J
or run the following snippet (both tryfilterColor.set(coord.x < 0.5 ? red : green);) - observe all-red canvas (should be half green)
- observe the transpiled GLSL in console has over-simplified the code
Snippet:
const red = [1, 0, 0, 1]; const green = [0, 1, 0, 1]; const coord = filterColor.texCoord; filterColor.set(coord.x < 0.5 ? red : green);
gets compiled to...
vec4 getColor(FilterInputs inputs, sampler2D canvasContent) { return vec4(1.0000, 0.0000, 0.0000, 1.0000); }