shaders 2.2.23 → 2.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/core/AngularBlur-Dl2gwk68.js +64 -0
  2. package/dist/core/Ascii-Dha_QpT3.js +286 -0
  3. package/dist/core/Beam-CTN9Ni43.js +139 -0
  4. package/dist/core/Blob-CxFDZovO.js +218 -0
  5. package/dist/core/Blur-Y2FsmFk_.js +77 -0
  6. package/dist/core/Bulge-Cb-t0xqI.js +132 -0
  7. package/dist/core/CRTScreen-CtERsenz.js +112 -0
  8. package/dist/core/ChannelBlur-CvM6GJgZ.js +118 -0
  9. package/dist/core/Checkerboard-CgB-egNY.js +83 -0
  10. package/dist/core/ChromaFlow-vRCwhQpN.js +222 -0
  11. package/dist/core/ChromaticAberration-FTquTQIL.js +88 -0
  12. package/dist/core/Circle-Daziv5d7.js +67 -0
  13. package/dist/core/CursorTrail-Bsz9e6Fn.js +145 -0
  14. package/dist/core/DiffuseBlur-Cj2PtRNd.js +83 -0
  15. package/dist/core/Dither-D2Nf4p3w.js +66 -0
  16. package/dist/core/DotGrid-CzOwquo4.js +75 -0
  17. package/dist/core/Duotone-XuTN9tI7.js +65 -0
  18. package/dist/core/FilmGrain-D3-nbi12.js +28 -0
  19. package/dist/core/FloatingParticles-D9Nnu1qg.js +217 -0
  20. package/dist/core/GlassTiles-CnjCvajI.js +69 -0
  21. package/dist/core/Glow-BluFc9be.js +75 -0
  22. package/dist/core/Godrays-ChLh_vGl.js +144 -0
  23. package/dist/core/Grayscale-DRny75A9.js +20 -0
  24. package/dist/core/Grid-DgyDa4H1.js +58 -0
  25. package/dist/core/GridDistortion-BAspCYvp.js +188 -0
  26. package/dist/core/Group-Dul7PUBl.js +14 -0
  27. package/dist/core/Halftone-Ifv5F_FT.js +65 -0
  28. package/dist/core/HueShift-De8ukMWs.js +31 -0
  29. package/dist/core/ImageTexture-DvYcQgJB.js +143 -0
  30. package/dist/core/Invert-Fz0NtIJc.js +21 -0
  31. package/dist/core/LinearBlur-LmhnQoA4.js +62 -0
  32. package/dist/core/LinearGradient-xbloQjzt.js +133 -0
  33. package/dist/core/Liquify-DMe1V5-O.js +175 -0
  34. package/dist/core/Pixelate-Cv8537Pj.js +37 -0
  35. package/dist/core/PolarCoordinates-DDvDhBE-.js +112 -0
  36. package/dist/core/Posterize-3m3xkWOz.js +29 -0
  37. package/dist/core/ProgressiveBlur-EGkevObV.js +121 -0
  38. package/dist/core/RadialGradient-B7ZZB_VJ.js +71 -0
  39. package/dist/core/RectangularCoordinates-muWR8mZS.js +101 -0
  40. package/dist/core/Ripples-8XaZaXQF.js +117 -0
  41. package/dist/core/Saturation-CYFI1jzN.js +30 -0
  42. package/dist/core/SimplexNoise-DJUe0wz_.js +99 -0
  43. package/dist/core/SineWave-Dl3nFO1W.js +120 -0
  44. package/dist/core/SolidColor-CWGq_Bjq.js +21 -0
  45. package/dist/core/Spherize-C-jZEUsN.js +128 -0
  46. package/dist/core/Spiral-BSB_R39p.js +132 -0
  47. package/dist/core/Strands-0stO5BMy.js +161 -0
  48. package/dist/core/Stretch-B645paha.js +133 -0
  49. package/dist/core/Swirl-CVnbawit.js +173 -0
  50. package/dist/core/TiltShift-0CxNRI6L.js +134 -0
  51. package/dist/core/Tritone-Daa-I5UD.js +76 -0
  52. package/dist/core/Twirl-2CJVZEtk.js +96 -0
  53. package/dist/core/Vibrance-DRtecEvb.js +30 -0
  54. package/dist/core/WaveDistortion-BscXN2rs.js +173 -0
  55. package/dist/core/ZoomBlur-CAqK0Kju.js +62 -0
  56. package/dist/core/colorMixing-BXiTAqJU.js +69 -0
  57. package/dist/core/edges-Bn_OIa_h.js +26 -0
  58. package/dist/core/index.js +2257 -1604
  59. package/dist/core/shaderRegistry.d.ts.map +1 -1
  60. package/dist/core/shaders/AngularBlur/index.js +3 -7
  61. package/dist/core/shaders/Ascii/index.js +2 -6
  62. package/dist/core/shaders/Beam/index.d.ts +71 -0
  63. package/dist/core/shaders/Beam/index.d.ts.map +1 -0
  64. package/dist/core/shaders/Beam/index.js +4 -0
  65. package/dist/core/shaders/Blob/index.js +5 -9
  66. package/dist/core/shaders/Blur/index.js +2 -6
  67. package/dist/core/shaders/Bulge/index.js +4 -8
  68. package/dist/core/shaders/CRTScreen/index.js +2 -6
  69. package/dist/core/shaders/ChannelBlur/index.js +2 -6
  70. package/dist/core/shaders/Checkerboard/index.js +4 -8
  71. package/dist/core/shaders/ChromaFlow/index.js +3 -7
  72. package/dist/core/shaders/ChromaticAberration/index.js +3 -7
  73. package/dist/core/shaders/Circle/index.js +3 -7
  74. package/dist/core/shaders/CursorTrail/index.js +4 -8
  75. package/dist/core/shaders/DiffuseBlur/index.js +4 -8
  76. package/dist/core/shaders/Dither/index.js +3 -7
  77. package/dist/core/shaders/DotGrid/index.js +3 -7
  78. package/dist/core/shaders/Duotone/index.js +4 -8
  79. package/dist/core/shaders/FilmGrain/index.js +2 -6
  80. package/dist/core/shaders/FloatingParticles/index.js +3 -7
  81. package/dist/core/shaders/GlassTiles/index.js +2 -6
  82. package/dist/core/shaders/Glow/index.js +2 -6
  83. package/dist/core/shaders/Godrays/index.js +3 -7
  84. package/dist/core/shaders/Grayscale/index.js +2 -8
  85. package/dist/core/shaders/Grid/index.js +3 -7
  86. package/dist/core/shaders/GridDistortion/index.js +4 -8
  87. package/dist/core/shaders/Group/index.js +2 -6
  88. package/dist/core/shaders/Halftone/index.js +3 -7
  89. package/dist/core/shaders/HueShift/index.js +2 -8
  90. package/dist/core/shaders/ImageTexture/index.js +2 -6
  91. package/dist/core/shaders/Invert/index.js +2 -6
  92. package/dist/core/shaders/LinearBlur/index.js +3 -7
  93. package/dist/core/shaders/LinearGradient/index.js +4 -8
  94. package/dist/core/shaders/Liquify/index.js +4 -8
  95. package/dist/core/shaders/Pixelate/index.js +2 -6
  96. package/dist/core/shaders/PolarCoordinates/index.js +4 -8
  97. package/dist/core/shaders/Posterize/index.js +2 -7
  98. package/dist/core/shaders/ProgressiveBlur/index.js +3 -7
  99. package/dist/core/shaders/RadialGradient/index.js +4 -8
  100. package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
  101. package/dist/core/shaders/Ripples/index.js +5 -9
  102. package/dist/core/shaders/Saturation/index.js +2 -8
  103. package/dist/core/shaders/SimplexNoise/index.js +5 -9
  104. package/dist/core/shaders/SineWave/index.js +3 -7
  105. package/dist/core/shaders/SolidColor/index.js +3 -7
  106. package/dist/core/shaders/Spherize/index.js +3 -7
  107. package/dist/core/shaders/Spiral/index.js +4 -8
  108. package/dist/core/shaders/Strands/index.js +4 -8
  109. package/dist/core/shaders/Stretch/index.js +4 -8
  110. package/dist/core/shaders/Swirl/index.js +5 -9
  111. package/dist/core/shaders/TiltShift/index.js +3 -7
  112. package/dist/core/shaders/Tritone/index.js +4 -8
  113. package/dist/core/shaders/Twirl/index.js +4 -8
  114. package/dist/core/shaders/Vibrance/index.js +2 -8
  115. package/dist/core/shaders/WaveDistortion/index.js +4 -8
  116. package/dist/core/shaders/ZoomBlur/index.js +3 -7
  117. package/dist/core/telemetry/index.js +189 -157
  118. package/dist/core/time-CTJvRUZ4.js +10 -0
  119. package/dist/core/transformations-DxfQXZWi.js +4715 -0
  120. package/dist/react/components/Beam.d.ts +31 -0
  121. package/dist/react/components/Beam.d.ts.map +1 -0
  122. package/dist/react/generatePresetCode-CCibXbtZ.js +645 -0
  123. package/dist/react/index.d.ts +1 -0
  124. package/dist/react/index.d.ts.map +1 -1
  125. package/dist/react/index.js +7649 -104600
  126. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  127. package/dist/react/utils/generatePresetCode.js +2 -5
  128. package/dist/registry.js +224 -0
  129. package/dist/solid/components/Beam.d.ts +28 -0
  130. package/dist/solid/components/Beam.d.ts.map +1 -0
  131. package/dist/solid/index.d.ts +1 -0
  132. package/dist/solid/index.d.ts.map +1 -1
  133. package/dist/solid/index.js +6691 -102524
  134. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  135. package/dist/solid/utils/generatePresetCode.js +586 -537
  136. package/dist/svelte/components/Beam.svelte.d.ts +19 -0
  137. package/dist/svelte/generatePresetCode-CymgoDq_.js +645 -0
  138. package/dist/svelte/index.d.ts +1 -0
  139. package/dist/svelte/index.js +6175 -102455
  140. package/dist/svelte/utils/generatePresetCode.js +2 -5
  141. package/dist/vue/components/Beam.vue.d.ts +57 -0
  142. package/dist/vue/components/Beam.vue.d.ts.map +1 -0
  143. package/dist/vue/generatePresetCode-CRJmU8iF.js +649 -0
  144. package/dist/vue/index.d.ts +1 -0
  145. package/dist/vue/index.d.ts.map +1 -1
  146. package/dist/vue/index.js +6929 -103492
  147. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  148. package/dist/vue/utils/generatePresetCode.js +2 -5
  149. package/package.json +12 -1
  150. package/dist/core/AngularBlur-ClvtyURQ.js +0 -56
  151. package/dist/core/Ascii-BT0-K_vw.js +0 -196
  152. package/dist/core/Blob-BlQ_1T_8.js +0 -169
  153. package/dist/core/Blur-421AjWLH.js +0 -64
  154. package/dist/core/Bulge-CZRVoR6C.js +0 -103
  155. package/dist/core/CRTScreen-C_U9g_IR.js +0 -91
  156. package/dist/core/ChannelBlur-5pzcB6Zv.js +0 -89
  157. package/dist/core/Checkerboard-CrQkqXhD.js +0 -75
  158. package/dist/core/ChromaFlow-CNrQdL8f.js +0 -134
  159. package/dist/core/ChromaticAberration-D9H7O17Y.js +0 -82
  160. package/dist/core/Circle-DnLaDn8V.js +0 -62
  161. package/dist/core/ColorAdjustment-CKwpE_4M.js +0 -14
  162. package/dist/core/CursorTrail-NY6n97VG.js +0 -105
  163. package/dist/core/DiffuseBlur-C_n01ABk.js +0 -69
  164. package/dist/core/Dither-4s-c4zh4.js +0 -61
  165. package/dist/core/DotGrid-BYl8XdMi.js +0 -61
  166. package/dist/core/Duotone-DbewOoB4.js +0 -66
  167. package/dist/core/FilmGrain-zA_-knOw.js +0 -28
  168. package/dist/core/FloatingParticles-BhVnqMsE.js +0 -160
  169. package/dist/core/GlassTiles-CFI57glh.js +0 -52
  170. package/dist/core/Glow-CQgl3IoS.js +0 -66
  171. package/dist/core/Godrays-BHMix_Bh.js +0 -105
  172. package/dist/core/Grayscale-CAEFLteL.js +0 -21
  173. package/dist/core/Grid-DlM-rVbZ.js +0 -50
  174. package/dist/core/GridDistortion-ZOZphSAT.js +0 -147
  175. package/dist/core/Group-BQAs3RiH.js +0 -17
  176. package/dist/core/Halftone-ci4ga-_J.js +0 -55
  177. package/dist/core/HueShift-CyxzPcJV.js +0 -32
  178. package/dist/core/ImageTexture-CdAGsPuH.js +0 -105
  179. package/dist/core/Invert-iPsiIqNZ.js +0 -20
  180. package/dist/core/LinearBlur-BEaaoIk-.js +0 -56
  181. package/dist/core/LinearGradient-DR_7RxLX.js +0 -111
  182. package/dist/core/Liquify-Bi02_ugh.js +0 -139
  183. package/dist/core/Pixelate-CSsdT1rr.js +0 -38
  184. package/dist/core/PolarCoordinates-D626ml58.js +0 -103
  185. package/dist/core/Posterize-DhZkMaC7.js +0 -46
  186. package/dist/core/ProgressiveBlur-CGtCfLF8.js +0 -102
  187. package/dist/core/RadialGradient-C0_WzmbH.js +0 -71
  188. package/dist/core/RectangularCoordinates-DfXw7fhI.js +0 -92
  189. package/dist/core/Ripples-DkemN3eh.js +0 -106
  190. package/dist/core/Saturation-Dup81Pnq.js +0 -31
  191. package/dist/core/SimplexNoise-BYEiCjDj.js +0 -94
  192. package/dist/core/SineWave-C6MRPtsy.js +0 -107
  193. package/dist/core/SolidColor-BZHRczgb.js +0 -22
  194. package/dist/core/Spherize-DOAnDx2l.js +0 -103
  195. package/dist/core/Spiral-BMjnWXh1.js +0 -115
  196. package/dist/core/Strands-BOVsuJLe.js +0 -125
  197. package/dist/core/Stretch-D6bHc6yp.js +0 -103
  198. package/dist/core/Swirl-BFoc0ImG.js +0 -148
  199. package/dist/core/TSLBase-BFMvTOak.js +0 -8053
  200. package/dist/core/TiltShift-BiNvvhzj.js +0 -114
  201. package/dist/core/Tritone-gdx2AA0m.js +0 -75
  202. package/dist/core/Twirl-BsV8YbqC.js +0 -82
  203. package/dist/core/Vibrance-C182fbSw.js +0 -31
  204. package/dist/core/WaveDistortion-CmaS2zDB.js +0 -132
  205. package/dist/core/ZoomBlur-DLf5xQ16.js +0 -56
  206. package/dist/core/colorMixing--dhzx0ch.js +0 -21
  207. package/dist/core/edges-CDzKsauJ.js +0 -15
  208. package/dist/core/three.tsl-Btj1hLsf.js +0 -43845
  209. package/dist/core/time-DbRMw6Jm.js +0 -10
  210. package/dist/core/transformations-CsrIJXh-.js +0 -3992
  211. package/dist/react/generatePresetCode-DaS7jkcT.js +0 -626
  212. package/dist/svelte/generatePresetCode-DaS7jkcT.js +0 -626
  213. package/dist/vue/generatePresetCode-Cd1B-Y9j.js +0 -632
@@ -0,0 +1,62 @@
1
+ import { n as transformAngle } from "./transformations-DxfQXZWi.js";
2
+ import * as TSL from "three/tsl";
3
+ const componentDefinition = {
4
+ name: "LinearBlur",
5
+ category: "Blurs",
6
+ description: "Directional motion blur in a specific angle",
7
+ requiresRTT: true,
8
+ requiresChild: true,
9
+ props: {
10
+ intensity: {
11
+ default: 30,
12
+ description: "Intensity of the linear blur effect",
13
+ ui: {
14
+ type: "range",
15
+ min: 0,
16
+ max: 100,
17
+ step: 1,
18
+ label: "Intensity"
19
+ }
20
+ },
21
+ angle: {
22
+ default: 0,
23
+ transform: transformAngle,
24
+ description: "Direction of the linear blur (in degrees)",
25
+ ui: {
26
+ type: "range",
27
+ min: 0,
28
+ max: 360,
29
+ step: 1,
30
+ label: "Angle"
31
+ }
32
+ }
33
+ },
34
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
35
+ const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, viewportSize: viewportSize$1, sin: sin$1, cos: cos$1, radians, Fn, convertToTexture: convertToTexture$1 } = TSL;
36
+ if (!childNode) return vec4$1(0, 0, 0, 0);
37
+ const childTexture = convertToTexture$1(childNode);
38
+ onCleanup(() => {
39
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
40
+ });
41
+ const angleRad = radians(uniforms.angle.uniform);
42
+ const blurDirection = vec2$1(cos$1(angleRad), sin$1(angleRad));
43
+ return Fn(() => {
44
+ const uv = screenUV$1;
45
+ const texel = vec2$1(1).div(viewportSize$1);
46
+ const blurVector = blurDirection.mul(uniforms.intensity.uniform).mul(texel).mul(2);
47
+ const total = vec4$1(0).toVar();
48
+ const totalWeight = float$1(0).toVar();
49
+ for (let i = 0; i < 32; i++) {
50
+ const t = float$1(i).div(float$1(31)).sub(.5).mul(2);
51
+ const weight = float$1(1).div(float$1(2.506628)).mul(float$1(-.5).mul(t).mul(t).div(float$1(.64)).exp());
52
+ const coord = uv.add(blurVector.mul(t.mul(.5)));
53
+ const sample = childTexture.sample(coord).mul(weight);
54
+ total.assign(total.add(sample));
55
+ totalWeight.assign(totalWeight.add(weight));
56
+ }
57
+ return total.div(totalWeight);
58
+ })();
59
+ }
60
+ };
61
+ var LinearBlur_default = componentDefinition;
62
+ export { componentDefinition as n, LinearBlur_default as t };
@@ -0,0 +1,133 @@
1
+ import { a as transformEdges, i as transformColorSpace, n as transformAngle, o as transformPosition, r as transformColor, t as colorSpaceOptions } from "./transformations-DxfQXZWi.js";
2
+ import { t as mixColors } from "./colorMixing-BXiTAqJU.js";
3
+ import * as TSL from "three/tsl";
4
+ const componentDefinition = {
5
+ name: "LinearGradient",
6
+ category: "Base Layers",
7
+ description: "Create smooth linear color gradients",
8
+ acceptsUVContext: true,
9
+ props: {
10
+ colorA: {
11
+ default: "#1aff00",
12
+ transform: transformColor,
13
+ description: "The starting color of the gradient",
14
+ ui: {
15
+ type: "color",
16
+ label: "Color A"
17
+ }
18
+ },
19
+ colorB: {
20
+ default: "#0000ff",
21
+ transform: transformColor,
22
+ description: "The ending color of the gradient",
23
+ ui: {
24
+ type: "color",
25
+ label: "Color B"
26
+ }
27
+ },
28
+ start: {
29
+ default: {
30
+ x: 0,
31
+ y: .5
32
+ },
33
+ transform: transformPosition,
34
+ description: "The starting point of the gradient",
35
+ ui: {
36
+ type: "position",
37
+ label: "Start"
38
+ }
39
+ },
40
+ end: {
41
+ default: {
42
+ x: 1,
43
+ y: .5
44
+ },
45
+ transform: transformPosition,
46
+ description: "The ending point of the gradient",
47
+ ui: {
48
+ type: "position",
49
+ label: "End"
50
+ }
51
+ },
52
+ angle: {
53
+ default: 0,
54
+ transform: transformAngle,
55
+ description: "Additional rotation angle of the gradient (in degrees)",
56
+ ui: {
57
+ type: "range",
58
+ min: 0,
59
+ max: 360,
60
+ step: 1,
61
+ label: "Angle"
62
+ }
63
+ },
64
+ edges: {
65
+ default: "stretch",
66
+ transform: transformEdges,
67
+ description: "How to handle areas beyond the gradient endpoints",
68
+ ui: {
69
+ type: "select",
70
+ options: [
71
+ {
72
+ label: "Stretch",
73
+ value: "stretch"
74
+ },
75
+ {
76
+ label: "Transparent",
77
+ value: "transparent"
78
+ },
79
+ {
80
+ label: "Mirror",
81
+ value: "mirror"
82
+ },
83
+ {
84
+ label: "Wrap",
85
+ value: "wrap"
86
+ }
87
+ ],
88
+ label: "Edges"
89
+ }
90
+ },
91
+ colorSpace: {
92
+ default: "linear",
93
+ transform: transformColorSpace,
94
+ description: "Color space for color interpolation",
95
+ ui: {
96
+ type: "select",
97
+ options: colorSpaceOptions,
98
+ label: "Color Space"
99
+ }
100
+ }
101
+ },
102
+ fragmentNode: ({ uniforms, uvContext }) => {
103
+ const { vec2: vec2$1, vec4: vec4$1, float: float$1, cos: cos$1, sin: sin$1, dot: dot$1, radians, screenUV: screenUV$1, length, normalize, abs: abs$1, mod, fract } = TSL;
104
+ const uv = uvContext ?? screenUV$1;
105
+ const startPos = vec2$1(uniforms.start.uniform[0], uniforms.start.uniform[1].oneMinus());
106
+ const endPos = vec2$1(uniforms.end.uniform[0], uniforms.end.uniform[1].oneMinus());
107
+ const gradientVector = endPos.sub(startPos);
108
+ const gradientLength = length(gradientVector);
109
+ const gradientDir = normalize(gradientVector);
110
+ const angleRad = radians(uniforms.angle.uniform).negate();
111
+ const cosAngle = cos$1(angleRad);
112
+ const sinAngle = sin$1(angleRad);
113
+ const midpoint = startPos.add(endPos).mul(.5);
114
+ const centeredUV = uv.sub(midpoint);
115
+ const t = dot$1(vec2$1(centeredUV.x.mul(cosAngle).sub(centeredUV.y.mul(sinAngle)), centeredUV.x.mul(sinAngle).add(centeredUV.y.mul(cosAngle))).add(midpoint).sub(startPos), gradientDir).div(gradientLength.max(1e-6));
116
+ const edgeMode = uniforms.edges.uniform;
117
+ const stretchT = t.clamp(float$1(0), float$1(1));
118
+ const inBoundsX = t.greaterThanEqual(float$1(0)).select(float$1(1), float$1(0));
119
+ const inBoundsY = t.lessThanEqual(float$1(1)).select(float$1(1), float$1(0));
120
+ const inBounds = inBoundsX.mul(inBoundsY);
121
+ const mirrorT = mod(abs$1(t), float$1(2));
122
+ const finalMirrorT = mirrorT.greaterThan(float$1(1)).select(float$1(2).sub(mirrorT), mirrorT);
123
+ const wrapT = fract(t);
124
+ const isMode1OrHigher = edgeMode.greaterThanEqual(float$1(.5));
125
+ const isMode2OrHigher = edgeMode.greaterThanEqual(float$1(1.5));
126
+ const finalT = edgeMode.greaterThanEqual(float$1(2.5)).select(wrapT, isMode2OrHigher.select(finalMirrorT, isMode1OrHigher.select(t, stretchT)));
127
+ const mixedColor = mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, finalT.clamp(float$1(0), float$1(1)), uniforms.colorSpace.uniform);
128
+ const finalAlpha = isMode1OrHigher.and(edgeMode.lessThan(float$1(1.5))).select(mixedColor.w.mul(inBounds), mixedColor.w);
129
+ return vec4$1(mixedColor.x, mixedColor.y, mixedColor.z, finalAlpha);
130
+ }
131
+ };
132
+ var LinearGradient_default = componentDefinition;
133
+ export { componentDefinition as n, LinearGradient_default as t };
@@ -0,0 +1,175 @@
1
+ import { t as applyEdgeHandling } from "./edges-Bn_OIa_h.js";
2
+ import { a as transformEdges } from "./transformations-DxfQXZWi.js";
3
+ import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
4
+ import * as TSL from "three/tsl";
5
+ var GRID_SIZE = 32;
6
+ var displacementStateCache = /* @__PURE__ */ new WeakMap();
7
+ var getOrCreateDisplacementState = (uniforms) => {
8
+ let state = displacementStateCache.get(uniforms);
9
+ if (!state) {
10
+ const data = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
11
+ const texture = new DataTexture(data, GRID_SIZE, GRID_SIZE, RGFormat, FloatType);
12
+ texture.magFilter = LinearFilter;
13
+ texture.minFilter = LinearFilter;
14
+ texture.needsUpdate = true;
15
+ state = {
16
+ texture,
17
+ data,
18
+ tslNode: TSL.texture(texture),
19
+ initialized: false
20
+ };
21
+ displacementStateCache.set(uniforms, state);
22
+ }
23
+ return state;
24
+ };
25
+ const componentDefinition = {
26
+ name: "Liquify",
27
+ category: "Interactive",
28
+ description: "Liquid-like interactive deformation effect",
29
+ requiresRTT: true,
30
+ requiresChild: true,
31
+ props: {
32
+ intensity: {
33
+ default: 1,
34
+ description: "Strength of the distortion effect",
35
+ ui: {
36
+ type: "range",
37
+ min: 0,
38
+ max: 5,
39
+ step: .1,
40
+ label: "Intensity"
41
+ }
42
+ },
43
+ swirl: {
44
+ default: 0,
45
+ description: "Amount of swirl motion (0-1)",
46
+ ui: {
47
+ type: "range",
48
+ min: 0,
49
+ max: 1,
50
+ step: .01,
51
+ label: "Swirl"
52
+ }
53
+ },
54
+ decay: {
55
+ default: 3,
56
+ description: "Rate of distortion decay (higher = faster)",
57
+ ui: {
58
+ type: "range",
59
+ min: 0,
60
+ max: 10,
61
+ step: .1,
62
+ label: "Decay"
63
+ }
64
+ },
65
+ radius: {
66
+ default: 1,
67
+ description: "Radius of the distortion effect",
68
+ ui: {
69
+ type: "range",
70
+ min: 0,
71
+ max: 3,
72
+ step: .01,
73
+ label: "Radius"
74
+ }
75
+ },
76
+ edges: {
77
+ default: "stretch",
78
+ description: "How to handle edges when distortion pushes content out of bounds",
79
+ transform: transformEdges,
80
+ ui: {
81
+ type: "select",
82
+ options: [
83
+ {
84
+ label: "Stretch",
85
+ value: "stretch"
86
+ },
87
+ {
88
+ label: "Transparent",
89
+ value: "transparent"
90
+ },
91
+ {
92
+ label: "Mirror",
93
+ value: "mirror"
94
+ },
95
+ {
96
+ label: "Wrap",
97
+ value: "wrap"
98
+ }
99
+ ],
100
+ label: "Edges"
101
+ }
102
+ }
103
+ },
104
+ uvTransformNode: ({ uv, uniforms }) => {
105
+ const { vec2: vec2$1, float: float$1 } = TSL;
106
+ const displacement = getOrCreateDisplacementState(uniforms).tslNode.sample(uv).xy;
107
+ const maxDisplacement = float$1(.2);
108
+ const clampedDisplacement = displacement.clamp(vec2$1(maxDisplacement.negate(), maxDisplacement.negate()), vec2$1(maxDisplacement, maxDisplacement));
109
+ return uv.sub(clampedDisplacement);
110
+ },
111
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup }) => {
112
+ const { vec2: vec2$1, vec4: vec4$1, float: float$1, uniform: uniform$1, screenUV: screenUV$1, convertToTexture: convertToTexture$1 } = TSL;
113
+ const { texture: displacementTexture, data: displacementData, tslNode: displacementField } = getOrCreateDisplacementState(uniforms);
114
+ const mouseVelX = uniform$1(0);
115
+ const mouseVelY = uniform$1(0);
116
+ let prevX = .5;
117
+ let prevY = .5;
118
+ let lastTime = Date.now();
119
+ onBeforeRender(({ pointer }) => {
120
+ const currentTime = Date.now();
121
+ const dt = Math.min((currentTime - lastTime) / 1e3, .016);
122
+ lastTime = currentTime;
123
+ const velX = dt > 0 ? (pointer.x - prevX) / dt : 0;
124
+ const velY = dt > 0 ? (pointer.y - prevY) / dt : 0;
125
+ mouseVelX.value = mouseVelX.value * .85 + velX * .15;
126
+ mouseVelY.value = mouseVelY.value * .85 + velY * .15;
127
+ const decay = uniforms.decay.uniform.value;
128
+ const intensity = uniforms.intensity.uniform.value;
129
+ const radius = uniforms.radius.uniform.value * .05;
130
+ const swirl = uniforms.swirl.uniform.value;
131
+ for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
132
+ const idx = (i * GRID_SIZE + j) * 2;
133
+ displacementData[idx] *= 1 - decay * dt;
134
+ displacementData[idx + 1] *= 1 - decay * dt;
135
+ const cellX = (j + .5) / GRID_SIZE;
136
+ const cellY = (i + .5) / GRID_SIZE;
137
+ const dx = cellX - pointer.x;
138
+ const dy = cellY - pointer.y;
139
+ const dist = Math.sqrt(dx * dx + dy * dy);
140
+ if (dist < radius * 2 && Math.abs(velX) + Math.abs(velY) > .01) {
141
+ const influence = Math.exp(-dist * dist / (radius * radius));
142
+ displacementData[idx] += mouseVelX.value * influence * intensity * dt * .5;
143
+ displacementData[idx + 1] += mouseVelY.value * influence * intensity * dt * .5;
144
+ if (swirl > 0) {
145
+ const angle = Math.atan2(dy, dx) + Math.PI * .5;
146
+ displacementData[idx] += Math.cos(angle) * swirl * influence * dt * 2;
147
+ displacementData[idx + 1] += Math.sin(angle) * swirl * influence * dt * 2;
148
+ }
149
+ }
150
+ displacementData[idx] = Math.max(-1, Math.min(1, displacementData[idx]));
151
+ displacementData[idx + 1] = Math.max(-1, Math.min(1, displacementData[idx + 1]));
152
+ }
153
+ displacementTexture.needsUpdate = true;
154
+ prevX = pointer.x;
155
+ prevY = pointer.y;
156
+ });
157
+ onCleanup(() => {
158
+ displacementTexture.dispose();
159
+ displacementStateCache.delete(uniforms);
160
+ });
161
+ if (!childNode) return vec4$1(0, 0, 0, 0);
162
+ const childTexture = convertToTexture$1(childNode);
163
+ onCleanup(() => {
164
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
165
+ });
166
+ const displacement = displacementField.sample(screenUV$1).xy;
167
+ const maxDisplacement = float$1(.2);
168
+ const negMaxDisplacement = float$1(-.2);
169
+ const clampedDisplacement = displacement.clamp(vec2$1(negMaxDisplacement, negMaxDisplacement), vec2$1(maxDisplacement, maxDisplacement));
170
+ const distortedUV = screenUV$1.sub(clampedDisplacement);
171
+ return applyEdgeHandling(distortedUV, childTexture.sample(distortedUV), childTexture, uniforms.edges.uniform);
172
+ }
173
+ };
174
+ var Liquify_default = componentDefinition;
175
+ export { componentDefinition as n, Liquify_default as t };
@@ -0,0 +1,37 @@
1
+ import * as TSL from "three/tsl";
2
+ const componentDefinition = {
3
+ name: "Pixelate",
4
+ category: "Stylize",
5
+ description: "Pixelation effect with adjustable cell size",
6
+ requiresRTT: true,
7
+ requiresChild: true,
8
+ props: { scale: {
9
+ default: 50,
10
+ description: "Pixel size - higher values create larger, more visible pixels",
11
+ ui: {
12
+ type: "range",
13
+ min: 1,
14
+ max: 200,
15
+ step: 1,
16
+ label: "Scale"
17
+ }
18
+ } },
19
+ uvTransformNode: ({ uv, uniforms }) => {
20
+ const { floor } = TSL;
21
+ const pixelSize = uniforms.scale.uniform;
22
+ return floor(uv.mul(pixelSize)).div(pixelSize);
23
+ },
24
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
25
+ const { vec4: vec4$1, floor, screenUV: screenUV$1, convertToTexture: convertToTexture$1 } = TSL;
26
+ if (!childNode) return vec4$1(0, 0, 0, 0);
27
+ const childTexture = convertToTexture$1(childNode);
28
+ onCleanup(() => {
29
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
30
+ });
31
+ const pixelSize = uniforms.scale.uniform;
32
+ const pixelatedUV = floor(screenUV$1.mul(pixelSize)).div(pixelSize);
33
+ return childTexture.sample(pixelatedUV);
34
+ }
35
+ };
36
+ var Pixelate_default = componentDefinition;
37
+ export { componentDefinition as n, Pixelate_default as t };
@@ -0,0 +1,112 @@
1
+ import { t as applyEdgeHandling } from "./edges-Bn_OIa_h.js";
2
+ import { a as transformEdges, o as transformPosition } from "./transformations-DxfQXZWi.js";
3
+ import * as TSL from "three/tsl";
4
+ const componentDefinition = {
5
+ name: "PolarCoordinates",
6
+ category: "Distortions",
7
+ description: "Convert rectangular coordinates to polar space",
8
+ requiresRTT: true,
9
+ requiresChild: true,
10
+ props: {
11
+ center: {
12
+ default: {
13
+ x: .5,
14
+ y: .5
15
+ },
16
+ transform: transformPosition,
17
+ description: "The center point for polar coordinate conversion",
18
+ ui: {
19
+ type: "position",
20
+ label: "Center"
21
+ }
22
+ },
23
+ wrap: {
24
+ default: 1,
25
+ description: "Controls how much of the angular range to use (1 = full 360°, 0.5 = 180°)",
26
+ ui: {
27
+ type: "range",
28
+ min: 0,
29
+ max: 2,
30
+ step: .01,
31
+ label: "Wrap"
32
+ }
33
+ },
34
+ radius: {
35
+ default: 1,
36
+ description: "Controls how much of the radius range to use (affects the radial mapping)",
37
+ ui: {
38
+ type: "range",
39
+ min: 0,
40
+ max: 2,
41
+ step: .01,
42
+ label: "Radius"
43
+ }
44
+ },
45
+ intensity: {
46
+ default: 1,
47
+ description: "Blends between original UVs (0) and polar coordinates (1)",
48
+ ui: {
49
+ type: "range",
50
+ min: 0,
51
+ max: 1,
52
+ step: .01,
53
+ label: "Intensity"
54
+ }
55
+ },
56
+ edges: {
57
+ default: "transparent",
58
+ description: "How to handle edges when distortion pushes content out of bounds",
59
+ transform: transformEdges,
60
+ ui: {
61
+ type: "select",
62
+ options: [
63
+ {
64
+ label: "Stretch",
65
+ value: "stretch"
66
+ },
67
+ {
68
+ label: "Transparent",
69
+ value: "transparent"
70
+ },
71
+ {
72
+ label: "Mirror",
73
+ value: "mirror"
74
+ },
75
+ {
76
+ label: "Wrap",
77
+ value: "wrap"
78
+ }
79
+ ],
80
+ label: "Edges"
81
+ }
82
+ }
83
+ },
84
+ uvTransformNode: ({ uv, uniforms, viewportSize: viewportSize$1 }) => {
85
+ const { vec2: vec2$1, length, atan: atan$1, PI, mix: mix$1 } = TSL;
86
+ const aspect = viewportSize$1.x.div(viewportSize$1.y);
87
+ const aspectCorrectedUV = vec2$1(uv.x.mul(aspect), uv.y);
88
+ const centerPos = vec2$1(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
89
+ const delta = aspectCorrectedUV.sub(centerPos);
90
+ const normalizedAngle = atan$1(delta.y, delta.x).add(PI).div(PI.mul(2));
91
+ const r = length(delta);
92
+ return mix$1(uv, vec2$1(normalizedAngle.mul(uniforms.wrap.uniform), r.mul(uniforms.radius.uniform)), uniforms.intensity.uniform);
93
+ },
94
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
95
+ const { vec2: vec2$1, vec4: vec4$1, length, atan: atan$1, screenUV: screenUV$1, viewportSize: viewportSize$1, convertToTexture: convertToTexture$1, PI, mix: mix$1 } = TSL;
96
+ if (!childNode) return vec4$1(0, 0, 0, 0);
97
+ const childTexture = convertToTexture$1(childNode);
98
+ onCleanup(() => {
99
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
100
+ });
101
+ const aspect = viewportSize$1.x.div(viewportSize$1.y);
102
+ const aspectCorrectedUV = vec2$1(screenUV$1.x.mul(aspect), screenUV$1.y);
103
+ const centerPos = vec2$1(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
104
+ const delta = aspectCorrectedUV.sub(centerPos);
105
+ const normalizedAngle = atan$1(delta.y, delta.x).add(PI).div(PI.mul(2));
106
+ const r = length(delta);
107
+ const blendedUV = mix$1(screenUV$1, vec2$1(normalizedAngle.mul(uniforms.wrap.uniform), r.mul(uniforms.radius.uniform)), uniforms.intensity.uniform);
108
+ return applyEdgeHandling(blendedUV, childTexture.sample(blendedUV), childTexture, uniforms.edges.uniform);
109
+ }
110
+ };
111
+ var PolarCoordinates_default = componentDefinition;
112
+ export { componentDefinition as n, PolarCoordinates_default as t };
@@ -0,0 +1,29 @@
1
+ import * as TSL from "three/tsl";
2
+ import { posterize } from "three/src/nodes/display/PosterizeNode";
3
+ const componentDefinition = {
4
+ name: "Posterize",
5
+ category: "Adjustments",
6
+ description: "Reduce color depth to create a poster effect",
7
+ requiresChild: true,
8
+ props: { intensity: {
9
+ default: 5,
10
+ description: "The intensity of the posterization effect (lower is more posterized)",
11
+ ui: {
12
+ type: "range",
13
+ min: 2,
14
+ max: 20,
15
+ step: 1,
16
+ label: "Intensity"
17
+ }
18
+ } },
19
+ fragmentNode: ({ uniforms, childNode }) => {
20
+ const { vec4: vec4$1, int } = TSL;
21
+ if (!childNode) {
22
+ console.error("You must pass a child component into the Posterize shader.");
23
+ return vec4$1(0);
24
+ }
25
+ return posterize(childNode || vec4$1(0, 0, 0, 0), int(uniforms.intensity.uniform));
26
+ }
27
+ };
28
+ var Posterize_default = componentDefinition;
29
+ export { componentDefinition as n, Posterize_default as t };
@@ -0,0 +1,121 @@
1
+ import { n as transformAngle, o as transformPosition } from "./transformations-DxfQXZWi.js";
2
+ import * as TSL from "three/tsl";
3
+ const componentDefinition = {
4
+ name: "ProgressiveBlur",
5
+ category: "Blurs",
6
+ description: "Blur that increases progressively in one direction",
7
+ requiresRTT: true,
8
+ requiresChild: true,
9
+ props: {
10
+ intensity: {
11
+ default: 50,
12
+ description: "Maximum intensity of the blur effect",
13
+ ui: {
14
+ type: "range",
15
+ min: 0,
16
+ max: 100,
17
+ step: 1,
18
+ label: "Intensity"
19
+ }
20
+ },
21
+ angle: {
22
+ default: 0,
23
+ transform: transformAngle,
24
+ description: "Direction of the blur gradient (in degrees)",
25
+ ui: {
26
+ type: "range",
27
+ min: 0,
28
+ max: 360,
29
+ step: 1,
30
+ label: "Angle"
31
+ }
32
+ },
33
+ center: {
34
+ default: {
35
+ x: 0,
36
+ y: .5
37
+ },
38
+ transform: transformPosition,
39
+ description: "Center point where blur begins",
40
+ ui: {
41
+ type: "position",
42
+ label: "Center"
43
+ }
44
+ },
45
+ falloff: {
46
+ default: 1,
47
+ description: "Distance over which blur transitions to full strength",
48
+ ui: {
49
+ type: "range",
50
+ min: 0,
51
+ max: 1,
52
+ step: .01,
53
+ label: "Falloff"
54
+ }
55
+ }
56
+ },
57
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
58
+ const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, viewportSize: viewportSize$1, sin: sin$1, cos: cos$1, radians, max: max$1, smoothstep, Fn, convertToTexture: convertToTexture$1 } = TSL;
59
+ if (!childNode) return vec4$1(0, 0, 0, 0);
60
+ const childTexture = convertToTexture$1(childNode);
61
+ onCleanup(() => {
62
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
63
+ });
64
+ const angleRad = radians(uniforms.angle.uniform);
65
+ const direction = vec2$1(cos$1(angleRad), sin$1(angleRad));
66
+ const centerPosition = vec2$1(uniforms.center.uniform[0], uniforms.center.uniform[1].oneMinus());
67
+ const centeredUV = screenUV$1.sub(centerPosition);
68
+ const directionalDist = max$1(float$1(0), centeredUV.dot(direction));
69
+ const falloff = max$1(float$1(.001), uniforms.falloff.uniform);
70
+ const blurAmount = smoothstep(float$1(0), falloff, directionalDist);
71
+ const scaledIntensity = uniforms.intensity.uniform.mul(.06);
72
+ const blurRadius = blurAmount.mul(scaledIntensity);
73
+ const weights = [
74
+ .056,
75
+ .135,
76
+ .278,
77
+ .487,
78
+ .726,
79
+ .923,
80
+ 1,
81
+ .923,
82
+ .726,
83
+ .487,
84
+ .278,
85
+ .135,
86
+ .056
87
+ ];
88
+ const weightSum = 6.214;
89
+ const horizontalTexture = convertToTexture$1(Fn(() => {
90
+ const uv = screenUV$1;
91
+ const pixelSize = vec2$1(1).div(viewportSize$1);
92
+ const total = vec4$1(0).toVar();
93
+ for (let x = -6; x <= 6; x++) {
94
+ const weight = float$1(weights[x + 6] / weightSum);
95
+ const offset = vec2$1(float$1(x), float$1(0)).mul(blurRadius).mul(pixelSize);
96
+ const sampleCoord = uv.add(offset);
97
+ const sample = childTexture.sample(sampleCoord).mul(weight);
98
+ total.assign(total.add(sample));
99
+ }
100
+ return total;
101
+ })());
102
+ onCleanup(() => {
103
+ if (horizontalTexture?.renderTarget?.dispose) horizontalTexture.renderTarget.dispose();
104
+ });
105
+ return Fn(() => {
106
+ const uv = screenUV$1;
107
+ const pixelSize = vec2$1(1).div(viewportSize$1);
108
+ const total = vec4$1(0).toVar();
109
+ for (let y = -6; y <= 6; y++) {
110
+ const weight = float$1(weights[y + 6] / weightSum);
111
+ const offset = vec2$1(float$1(0), float$1(y)).mul(blurRadius).mul(pixelSize);
112
+ const sampleCoord = uv.add(offset);
113
+ const sample = horizontalTexture.sample(sampleCoord).mul(weight);
114
+ total.assign(total.add(sample));
115
+ }
116
+ return total;
117
+ })();
118
+ }
119
+ };
120
+ var ProgressiveBlur_default = componentDefinition;
121
+ export { componentDefinition as n, ProgressiveBlur_default as t };