Increasing access
Beginners using p5.strands need to know that color functions behave differently inside shader callbacks. Without strands-specific examples in the docs, it's not obvious how to use these functions in a modify() block.
Most appropriate sub-area of p5.js?
Feature enhancement details
Now that color(), lerpColor(), red(), green(), blue(), alpha(), hue(), saturation(), brightness(), and lightness() work inside p5.strands shader callbacks (added in #8822), the documentation should include strands-specific examples showing how to use these functions in a modify() callback.
Key things to document:
- In strands,
color() returns a vec4 instead of a p5.Color object
- All color values are represented as normalized RGBA values in the 0–1 range
colorMode() has no effect inside strands callbacks
- Common usage patterns for
lerpColor(), color channel accessors, and HSL/HSB accessors in shader code
Potential follow-up documentation work:
- Update existing p5.strands examples that currently use raw color vectors where the new
color() API would improve readability
- Add example sketches demonstrating hex strings, CSS color names, and
rgb()/rgba() inputs inside strands
- Review existing strands examples and helper functions for opportunities to showcase the newly added color APIs
Related PR: #8822
Increasing access
Beginners using p5.strands need to know that color functions behave differently inside shader callbacks. Without strands-specific examples in the docs, it's not obvious how to use these functions in a
modify()block.Most appropriate sub-area of p5.js?
Feature enhancement details
Now that
color(),lerpColor(),red(),green(),blue(),alpha(),hue(),saturation(),brightness(), andlightness()work inside p5.strands shader callbacks (added in #8822), the documentation should include strands-specific examples showing how to use these functions in amodify()callback.Key things to document:
color()returns avec4instead of ap5.ColorobjectcolorMode()has no effect inside strands callbackslerpColor(), color channel accessors, and HSL/HSB accessors in shader codePotential follow-up documentation work:
color()API would improve readabilityrgb()/rgba()inputs inside strandsRelated PR: #8822