Repository navigation
Add Shaders examples section + some new examples - #1635
davepagurek wants to merge 4 commits into
Conversation
ksen0
left a comment
There was a problem hiding this comment.
Thank you for adding these, so exciting! I added some optional feedback.
| gradientShader = buildFilterShader(gradient); | ||
| } | ||
|
|
||
| function gradient() { |
There was a problem hiding this comment.
I think it would be helpful to add some comments (same for all them) that demonstrate how we talk abotu p5.sstrands eg: the code inside gradient() is p5.strands code, which is not quite normal JavaScript: here GLSL can be used as well as p5.js, and these define shades. filterColor is a hook, and is used to define shader behavior. Tiny notes about that.
| function gradient() { | ||
| filterColor.begin(); | ||
| let start = [0.1, 0.1]; | ||
| let end = [mouseX, mouseY] / [width, height]; |
There was a problem hiding this comment.
Every place where the sketch author needs to switch to [0,1] range logic could also use a comment imo
| // randomSeed(floor(frameCount / 5)) | ||
| let start = [0.1, 0.1]; | ||
| let end = [mouseX, mouseY] / [width, height]; | ||
| let startToPixel = length(filterColor.texCoord - start); |
There was a problem hiding this comment.
explaining what texCoord here is, maybe spelling out "tex" is for "texture" in the comment?
| let depth = uniformTexture('depth'); | ||
|
|
||
| function getBlurriness(d) { | ||
| // Blur more the farther away we go from the |
There was a problem hiding this comment.
minor - naming: getTexture (strands, special) and getBlurriness (udf, arbitrary) are super different but kind of look/sound similar and are near each other. I know its clunky but maybe myBlurFunction instead of getBlurriness while a mouthful would highlight that this is not a special term of art, its just a sketch udf?
There was a problem hiding this comment.
Very minor: anyway this could be a little smaller in file size? It looks tiny so I wassurprised it's 1.7mb.
I was talking to @ksen0 about making the strands examples section more robust, with more entrypoints for people to learn about strands. This PR: