Skip to content

Commit 1b1028f

Browse files
committed
poi shader paragraph
1 parent b58ca40 commit 1b1028f

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/content/work/poi.mdx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,22 @@ order: 1
1919

2020
<Iframe src="https://flowarts.xyz" aspect="retro" />
2121

22-
For each stick, a rectangle is extruded along a curve created with a parametric equation:
22+
To create the fading trail, for each stick, a rectangle is extruded along a curve with a parametric
23+
equation:
2324

2425
```js
25-
x = cos(time * handTurns) * armLength + cos(time * poiTurns) * poiLength * (startOut ? 1 : -1);
26-
y = sin(time * handTurns) * armLength + sin(time * poiTurns) * poiLength * (startOut ? 1 : -1);
26+
x = cos(angle * handTurns) * armLength + cos(angle * poiTurns) * poiLength * (startOut ? 1 : -1);
27+
y = sin(angle * handTurns) * armLength + sin(angle * poiTurns) * poiLength * (startOut ? 1 : -1);
2728
```
2829

29-
Where `time` is the angle in radians between `0` and ``
30+
Where `angle` is in radians between `0` and ``
31+
32+
The extruded geometry's UVs are programmatically placed in a straight, horizontal row. The UVs slide
33+
along the X axis with time in the vertex shader. The UVs are then passed to the fragment shader
34+
where they drive the alpha with a smoothstep repeating on the X axis:
35+
36+
```glsl
37+
float alpha = smoothstep(0.75, 1.0, mod(dir * vUv.x, 1.0));
38+
```
3039

3140
<YouTube id="zQPcupoacjM" />

0 commit comments

Comments
 (0)