You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/tutorials/en/intro-to-p5-strands.mdx
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -327,6 +327,34 @@ By adding `time / 10000` to the phi angle and modifying the radius with `sin()`,
327
327
Try replacing `sin()` with `tan()`, `acosh()`, or combinations of functions. Small changes in shader code often create dramatically different visual effects, so experimentation goes a long way.
328
328
</ Callout>
329
329
330
+
#### p5.js variables available as uniforms
331
+
332
+
Some of the well-known p5.js global variables are made available to your shader as uniforms when you use p5.strands.
333
+
334
+
Within a strands callback function, you can use any of these directly:
335
+
336
+
* Dimensions: [width](/reference/p5/width),
337
+
[height](/reference/p5/height),
338
+
[displayWidth](/reference/p5/displayWidth),
339
+
[displayHeight](/reference/p5/displayHeight),
340
+
[windowWidth](/reference/p5/windowWidth),
341
+
[windowHeight](/reference/p5/windowHeight).
342
+
343
+
* Time and frameCount: [deltaTime](/reference/p5/deltaTime),
These are all floats (numbers) except `mouseIsPressed`, which is a boolean.
357
+
330
358
### Fresnel effect
331
359
If you've ever seen a material in a 3D render which appears to glow at the edges, or noticed how the light reflections appear to change on virtual water as you move your viewpoint, you were seeing the Fresnel effect. This effect changes how materials look when viewed at an angle.
0 commit comments