shaders 2.5.80 → 2.5.82

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 (199) hide show
  1. package/dist/core/FlowingGradient-DVproCI1.js +145 -0
  2. package/dist/core/Liquify-mhzPd19o.js +228 -0
  3. package/dist/core/{VideoTexture-DDnc6aVv.js → VideoTexture-Dbsbgb1Y.js} +1 -1
  4. package/dist/core/{WebcamTexture-rb0dLKSc.js → WebcamTexture-xvb8MuFz.js} +1 -1
  5. package/dist/core/index.js +77 -61
  6. package/dist/core/registry.js +62 -61
  7. package/dist/core/renderer.d.ts +1 -0
  8. package/dist/core/renderer.d.ts.map +1 -1
  9. package/dist/core/shaderRegistry-C0Tmid5z.js +220 -0
  10. package/dist/core/shaderRegistry.d.ts.map +1 -1
  11. package/dist/core/shaders/FlowingGradient/index.d.ts +62 -0
  12. package/dist/core/shaders/FlowingGradient/index.d.ts.map +1 -0
  13. package/dist/core/shaders/FlowingGradient/index.js +5 -0
  14. package/dist/core/shaders/Form3D/index.js +1 -1
  15. package/dist/core/shaders/Glass/index.js +1 -1
  16. package/dist/core/shaders/GlassTiles/index.js +1 -1
  17. package/dist/core/shaders/Glitch/index.js +1 -1
  18. package/dist/core/shaders/Glow/index.js +1 -1
  19. package/dist/core/shaders/Godrays/index.js +1 -1
  20. package/dist/core/shaders/Grayscale/index.js +1 -1
  21. package/dist/core/shaders/Grid/index.js +1 -1
  22. package/dist/core/shaders/GridDistortion/index.js +1 -1
  23. package/dist/core/shaders/Group/index.js +1 -1
  24. package/dist/core/shaders/Halftone/index.js +1 -1
  25. package/dist/core/shaders/HueShift/index.js +1 -1
  26. package/dist/core/shaders/ImageTexture/index.js +1 -1
  27. package/dist/core/shaders/Invert/index.js +1 -1
  28. package/dist/core/shaders/Kaleidoscope/index.js +1 -1
  29. package/dist/core/shaders/LensFlare/index.js +1 -1
  30. package/dist/core/shaders/LinearBlur/index.js +1 -1
  31. package/dist/core/shaders/LinearGradient/index.js +1 -1
  32. package/dist/core/shaders/Liquify/index.d.ts +13 -7
  33. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  34. package/dist/core/shaders/Liquify/index.js +1 -1
  35. package/dist/core/shaders/Mirror/index.js +1 -1
  36. package/dist/core/shaders/Neon/index.js +1 -1
  37. package/dist/core/shaders/Paper/index.js +1 -1
  38. package/dist/core/shaders/Perspective/index.js +1 -1
  39. package/dist/core/shaders/Pixelate/index.js +1 -1
  40. package/dist/core/shaders/Plasma/index.js +1 -1
  41. package/dist/core/shaders/PolarCoordinates/index.js +1 -1
  42. package/dist/core/shaders/Polygon/index.js +1 -1
  43. package/dist/core/shaders/Posterize/index.js +1 -1
  44. package/dist/core/shaders/ProgressiveBlur/index.js +1 -1
  45. package/dist/core/shaders/RadialGradient/index.js +1 -1
  46. package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
  47. package/dist/core/shaders/Ring/index.js +1 -1
  48. package/dist/core/shaders/Ripples/index.js +1 -1
  49. package/dist/core/shaders/RoundedRect/index.js +1 -1
  50. package/dist/core/shaders/Saturation/index.js +1 -1
  51. package/dist/core/shaders/Sharpness/index.js +1 -1
  52. package/dist/core/shaders/Shatter/index.js +1 -1
  53. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  54. package/dist/core/shaders/SineWave/index.js +1 -1
  55. package/dist/core/shaders/SolidColor/index.js +1 -1
  56. package/dist/core/shaders/Spherize/index.js +1 -1
  57. package/dist/core/shaders/Spiral/index.js +1 -1
  58. package/dist/core/shaders/Star/index.js +1 -1
  59. package/dist/core/shaders/Strands/index.js +1 -1
  60. package/dist/core/shaders/Stretch/index.js +1 -1
  61. package/dist/core/shaders/Stripes/index.js +1 -1
  62. package/dist/core/shaders/StudioBackground/index.js +1 -1
  63. package/dist/core/shaders/Swirl/index.js +1 -1
  64. package/dist/core/shaders/TiltShift/index.js +1 -1
  65. package/dist/core/shaders/Tint/index.js +1 -1
  66. package/dist/core/shaders/Trapezoid/index.js +1 -1
  67. package/dist/core/shaders/Tritone/index.js +1 -1
  68. package/dist/core/shaders/Twirl/index.js +1 -1
  69. package/dist/core/shaders/Vesica/index.js +1 -1
  70. package/dist/core/shaders/Vibrance/index.js +1 -1
  71. package/dist/core/shaders/VideoTexture/index.js +2 -2
  72. package/dist/core/shaders/WaveDistortion/index.js +1 -1
  73. package/dist/core/shaders/WebcamTexture/index.js +2 -2
  74. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  75. package/dist/js/createShader.d.ts.map +1 -1
  76. package/dist/js/createShader.js +2 -1
  77. package/dist/js/types.d.ts +1 -0
  78. package/dist/js/types.d.ts.map +1 -1
  79. package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
  80. package/dist/js/utils/generatePresetCode.js +16 -2
  81. package/dist/react/FlowingGradient.js +180 -0
  82. package/dist/react/Preview.js +1 -0
  83. package/dist/react/Shader.js +10 -2
  84. package/dist/react/components/FlowingGradient.d.ts +34 -0
  85. package/dist/react/components/FlowingGradient.d.ts.map +1 -0
  86. package/dist/react/components/Liquify.d.ts +4 -2
  87. package/dist/react/components/Liquify.d.ts.map +1 -1
  88. package/dist/react/engine/Preview.d.ts.map +1 -1
  89. package/dist/react/engine/Shader.d.ts +1 -0
  90. package/dist/react/engine/Shader.d.ts.map +1 -1
  91. package/dist/react/index.d.ts +1 -0
  92. package/dist/react/index.d.ts.map +1 -1
  93. package/dist/react/index.js +2 -1
  94. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  95. package/dist/react/utils/generatePresetCode.js +16 -2
  96. package/dist/registry.js +292 -20
  97. package/dist/solid/components/FlowingGradient.d.ts +31 -0
  98. package/dist/solid/components/FlowingGradient.d.ts.map +1 -0
  99. package/dist/solid/components/FlowingGradient.js +183 -0
  100. package/dist/solid/components/Liquify.d.ts +4 -2
  101. package/dist/solid/components/Liquify.d.ts.map +1 -1
  102. package/dist/solid/engine/Preview.d.ts.map +1 -1
  103. package/dist/solid/engine/Preview.js +64 -62
  104. package/dist/solid/engine/Shader.d.ts +1 -0
  105. package/dist/solid/engine/Shader.d.ts.map +1 -1
  106. package/dist/solid/engine/Shader.js +6 -2
  107. package/dist/solid/index.d.ts +1 -0
  108. package/dist/solid/index.d.ts.map +1 -1
  109. package/dist/solid/index.js +124 -122
  110. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  111. package/dist/solid/utils/generatePresetCode.js +16 -2
  112. package/dist/svelte/components/FlowingGradient.svelte.d.ts +21 -0
  113. package/dist/svelte/components/Liquify.svelte.d.ts +2 -1
  114. package/dist/svelte/engine/Shader.svelte.d.ts +1 -0
  115. package/dist/svelte/{generatePresetCode-BN1puRG_.js → generatePresetCode-B9QYLcji.js} +16 -2
  116. package/dist/svelte/index.d.ts +1 -0
  117. package/dist/svelte/index.js +450 -301
  118. package/dist/svelte/source/components/FlowingGradient.svelte +288 -0
  119. package/dist/svelte/source/components/Liquify.svelte +1 -0
  120. package/dist/svelte/source/engine/Preview.svelte +2 -0
  121. package/dist/svelte/source/engine/Shader.svelte +3 -1
  122. package/dist/svelte/source/index.js +1 -0
  123. package/dist/svelte/utils/generatePresetCode.js +1 -1
  124. package/dist/vue/FlowingGradient.js +3 -0
  125. package/dist/vue/FlowingGradient.vue_vue_type_script_setup_true_lang.js +173 -0
  126. package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +3 -2
  127. package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +2 -0
  128. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +5 -2
  129. package/dist/vue/components/FlowingGradient.vue.d.ts +56 -0
  130. package/dist/vue/components/FlowingGradient.vue.d.ts.map +1 -0
  131. package/dist/vue/components/Liquify.vue.d.ts +2 -1
  132. package/dist/vue/components/Liquify.vue.d.ts.map +1 -1
  133. package/dist/vue/engine/Shader.vue.d.ts +6 -2
  134. package/dist/vue/engine/Shader.vue.d.ts.map +1 -1
  135. package/dist/vue/index.d.ts +1 -0
  136. package/dist/vue/index.d.ts.map +1 -1
  137. package/dist/vue/index.js +2 -1
  138. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  139. package/dist/vue/utils/generatePresetCode.js +16 -2
  140. package/package.json +9 -1
  141. package/dist/core/Liquify-Cy6ck3_k.js +0 -157
  142. package/dist/core/shaderRegistry-9huRXSRI.js +0 -218
  143. /package/dist/core/{Form3D-D3MoN95S.js → Form3D-DhezVuyN.js} +0 -0
  144. /package/dist/core/{Glass-CRaFJ-8c.js → Glass-D7wAPADg.js} +0 -0
  145. /package/dist/core/{GlassTiles-C3PKMWgp.js → GlassTiles-ClrOIpCg.js} +0 -0
  146. /package/dist/core/{Glitch-MyIU0Bad.js → Glitch-DmWytiRl.js} +0 -0
  147. /package/dist/core/{Glow-1ee_R1fA.js → Glow-Dm4dfZ_m.js} +0 -0
  148. /package/dist/core/{Godrays-CvcPIegU.js → Godrays-CYILZUHg.js} +0 -0
  149. /package/dist/core/{Grayscale-8MPw9PHN.js → Grayscale-CPR_l4G2.js} +0 -0
  150. /package/dist/core/{Grid-D64zkkku.js → Grid-CCQZ3GhD.js} +0 -0
  151. /package/dist/core/{GridDistortion-B7PGORW3.js → GridDistortion-oGT8NaWa.js} +0 -0
  152. /package/dist/core/{Group-DoOcKuhW.js → Group-CC317vlL.js} +0 -0
  153. /package/dist/core/{Halftone-Co7P2SWy.js → Halftone-BZk1Hjz_.js} +0 -0
  154. /package/dist/core/{HueShift-Bvd9VTak.js → HueShift-CuE3YTBE.js} +0 -0
  155. /package/dist/core/{ImageTexture-BJ1udc62.js → ImageTexture-DWUSKXX0.js} +0 -0
  156. /package/dist/core/{Invert-5VR-fNRw.js → Invert-C9RiDYP_.js} +0 -0
  157. /package/dist/core/{Kaleidoscope-B0McCEhc.js → Kaleidoscope-DtVlQWKG.js} +0 -0
  158. /package/dist/core/{LensFlare-DXgpPyJK.js → LensFlare-AVpiDD1O.js} +0 -0
  159. /package/dist/core/{LinearBlur-CBl0B23J.js → LinearBlur-AR65FcZh.js} +0 -0
  160. /package/dist/core/{LinearGradient-C0FT7-Lc.js → LinearGradient-DXCXjS-K.js} +0 -0
  161. /package/dist/core/{Mirror-DfZBEOUf.js → Mirror-CSc5mJi1.js} +0 -0
  162. /package/dist/core/{Neon-E8whPM6C.js → Neon-By5OgQ24.js} +0 -0
  163. /package/dist/core/{Paper-DJwBbPxA.js → Paper-DfUka0dt.js} +0 -0
  164. /package/dist/core/{Perspective-BdHcCgqZ.js → Perspective-uPiPmWy_.js} +0 -0
  165. /package/dist/core/{Pixelate-B9x2E0k-.js → Pixelate-DRkAW4Lo.js} +0 -0
  166. /package/dist/core/{Plasma-CMXrHMJv.js → Plasma-ELzbK-Us.js} +0 -0
  167. /package/dist/core/{PolarCoordinates-tZbl0VOq.js → PolarCoordinates-CalS_TB6.js} +0 -0
  168. /package/dist/core/{Polygon-B4ab2iAo.js → Polygon-MN_gj5R6.js} +0 -0
  169. /package/dist/core/{Posterize-Big6cECo.js → Posterize-C4vtRmtA.js} +0 -0
  170. /package/dist/core/{ProgressiveBlur-D0ZlHOw4.js → ProgressiveBlur-CLYhfOvQ.js} +0 -0
  171. /package/dist/core/{RadialGradient-C1Uu5_bL.js → RadialGradient-DtD8HWdM.js} +0 -0
  172. /package/dist/core/{RectangularCoordinates-BB7_S4gH.js → RectangularCoordinates-B96mflF5.js} +0 -0
  173. /package/dist/core/{Ring-DVW66Ug0.js → Ring-76XLaaus.js} +0 -0
  174. /package/dist/core/{Ripples-DeRyNukC.js → Ripples-Cevf-Hvg.js} +0 -0
  175. /package/dist/core/{RoundedRect-B9y33WS5.js → RoundedRect-D6q6xf_O.js} +0 -0
  176. /package/dist/core/{Saturation-NrGhLp0a.js → Saturation-CcDwPh2v.js} +0 -0
  177. /package/dist/core/{Sharpness-DAC9Qnh0.js → Sharpness-D_dXfDEo.js} +0 -0
  178. /package/dist/core/{Shatter-ZIaXf4fs.js → Shatter-NfZzVt54.js} +0 -0
  179. /package/dist/core/{SimplexNoise-mSsE7oXX.js → SimplexNoise-aipzNV5j.js} +0 -0
  180. /package/dist/core/{SineWave-BAhTQVXp.js → SineWave-CVeYx3n-.js} +0 -0
  181. /package/dist/core/{SolidColor-BQnId3qy.js → SolidColor-BdbBnLxX.js} +0 -0
  182. /package/dist/core/{Spherize-YvHlKrZy.js → Spherize-BRGwLGeu.js} +0 -0
  183. /package/dist/core/{Spiral-DUDZyQjj.js → Spiral-BkTBXb7z.js} +0 -0
  184. /package/dist/core/{Star-DB4dmzyz.js → Star-DN6qziUO.js} +0 -0
  185. /package/dist/core/{Strands-CF49kt1s.js → Strands-Cjsw-cPu.js} +0 -0
  186. /package/dist/core/{Stretch-Dkhera5t.js → Stretch-9cta3Z1W.js} +0 -0
  187. /package/dist/core/{Stripes-BOROXiAH.js → Stripes-C0sCGCz_.js} +0 -0
  188. /package/dist/core/{StudioBackground-DNmf8LGj.js → StudioBackground-BYv_-8df.js} +0 -0
  189. /package/dist/core/{Swirl-C5RQIA6E.js → Swirl-DXjIXfy7.js} +0 -0
  190. /package/dist/core/{TiltShift-BgscLSg_.js → TiltShift-56lcZ4cJ.js} +0 -0
  191. /package/dist/core/{Tint-CvKUJTtg.js → Tint-8_WIy9_e.js} +0 -0
  192. /package/dist/core/{Trapezoid-Co8cWZTK.js → Trapezoid-C-HfI0fp.js} +0 -0
  193. /package/dist/core/{Tritone-Ss5m7yFO.js → Tritone-nyJyybHI.js} +0 -0
  194. /package/dist/core/{Twirl-CF_9ObSp.js → Twirl-BzSEz4xK.js} +0 -0
  195. /package/dist/core/{Vesica-C7tcbHbW.js → Vesica-DXWePxDj.js} +0 -0
  196. /package/dist/core/{Vibrance-DVWcESAa.js → Vibrance-BETLN3Ie.js} +0 -0
  197. /package/dist/core/{WaveDistortion-Caj3cQz7.js → WaveDistortion-C-j597Jm.js} +0 -0
  198. /package/dist/core/{ZoomBlur-DUrSxwl0.js → ZoomBlur-DFw0J9x3.js} +0 -0
  199. /package/dist/core/{browser-daS5XZwr.js → browser-CqdrcD5J.js} +0 -0
@@ -0,0 +1,145 @@
1
+ import { a as transformColor, o as transformColorSpace, t as colorSpaceOptions } from "./transformations-B5lM6fYX.js";
2
+ import { t as mixColors } from "./colorMixing-BPpDnR5I.js";
3
+ import { t as createAnimatedTime } from "./time-DUqSFWvT.js";
4
+ import { Fn, abs, clamp, cos, float, mix, mx_noise_float, pow, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
5
+ const componentDefinition = {
6
+ name: "FlowingGradient",
7
+ category: "Textures",
8
+ description: "Liquid silk gradient with organic flowing color bands",
9
+ props: {
10
+ colorA: {
11
+ default: "#0a0015",
12
+ transform: transformColor,
13
+ description: "Deep background color",
14
+ ui: {
15
+ type: "color",
16
+ label: "Color A",
17
+ group: "Colors"
18
+ }
19
+ },
20
+ colorB: {
21
+ default: "#6b17e6",
22
+ transform: transformColor,
23
+ description: "Primary accent color",
24
+ ui: {
25
+ type: "color",
26
+ label: "Color B",
27
+ group: "Colors"
28
+ }
29
+ },
30
+ colorC: {
31
+ default: "#ff4d6a",
32
+ transform: transformColor,
33
+ description: "Secondary accent color",
34
+ ui: {
35
+ type: "color",
36
+ label: "Color C",
37
+ group: "Colors"
38
+ }
39
+ },
40
+ colorD: {
41
+ default: "#ff6b35",
42
+ transform: transformColor,
43
+ description: "Tertiary accent color",
44
+ ui: {
45
+ type: "color",
46
+ label: "Color D",
47
+ group: "Colors"
48
+ }
49
+ },
50
+ colorSpace: {
51
+ default: "oklch",
52
+ transform: transformColorSpace,
53
+ compileTime: true,
54
+ description: "Color space for color interpolation",
55
+ ui: {
56
+ type: "select",
57
+ options: colorSpaceOptions,
58
+ label: "Color Space",
59
+ group: "Colors"
60
+ }
61
+ },
62
+ speed: {
63
+ default: 1,
64
+ description: "Animation speed",
65
+ ui: {
66
+ type: "range",
67
+ min: 0,
68
+ max: 10,
69
+ step: .1,
70
+ label: "Speed",
71
+ group: "Effect"
72
+ }
73
+ },
74
+ distortion: {
75
+ default: .5,
76
+ description: "Organic distortion intensity",
77
+ ui: {
78
+ type: ["range", "map"],
79
+ min: 0,
80
+ max: 2,
81
+ step: .1,
82
+ label: "Distortion",
83
+ group: "Effect"
84
+ }
85
+ },
86
+ seed: {
87
+ default: 0,
88
+ description: "Random seed for variation",
89
+ ui: {
90
+ type: ["range", "map"],
91
+ min: 0,
92
+ max: 100,
93
+ step: 1,
94
+ label: "Seed",
95
+ group: "Effect"
96
+ }
97
+ }
98
+ },
99
+ fragmentNode: (params) => {
100
+ const { uniforms } = params;
101
+ const colorA = uniforms.colorA.uniform;
102
+ const colorB = uniforms.colorB.uniform;
103
+ const colorC = uniforms.colorC.uniform;
104
+ const colorD = uniforms.colorD.uniform;
105
+ const csMode = uniforms.colorSpace.uniform.value;
106
+ const distortion = uniforms.distortion.uniform;
107
+ const seed = uniforms.seed.uniform;
108
+ const t = createAnimatedTime(params, uniforms.speed).mul(.075);
109
+ const aspect = viewportSize.x.div(viewportSize.y);
110
+ return Fn(() => {
111
+ const uv$1 = screenUV.sub(.5).toVar();
112
+ const seedOff = seed.mul(.17);
113
+ const angle = mx_noise_float(vec3(uv$1.x.mul(.8).add(t.mul(.4)), uv$1.y.mul(.8).sub(t.mul(.25)), seedOff)).mul(4 * Math.PI).mul(distortion);
114
+ const uvCorr = vec2(uv$1.x, uv$1.y.div(aspect));
115
+ const ca = cos(angle);
116
+ const sa = sin(angle);
117
+ uv$1.assign(vec2(uvCorr.x.mul(ca).sub(uvCorr.y.mul(sa)), uvCorr.x.mul(sa).add(uvCorr.y.mul(ca)).mul(aspect)));
118
+ const ws = t.mul(2);
119
+ uv$1.x.assign(uv$1.x.add(sin(uv$1.y.mul(5).add(ws)).div(50).mul(distortion)));
120
+ uv$1.y.assign(uv$1.y.add(sin(uv$1.x.mul(7.5).add(ws)).div(25).mul(distortion)));
121
+ const wp1 = vec3(uv$1.x.mul(2), uv$1.y.mul(2), t.mul(.5).add(seedOff));
122
+ const wx1 = mx_noise_float(wp1.add(vec3(5.2, 1.3, 0)));
123
+ const wy1 = mx_noise_float(wp1.add(vec3(1.7, 9.2, 0)));
124
+ uv$1.assign(uv$1.add(vec2(wx1, wy1).mul(.25).mul(distortion)));
125
+ const wp2 = vec3(uv$1.x.mul(1.5), uv$1.y.mul(1.5), t.mul(.3).add(seedOff));
126
+ const wx2 = mx_noise_float(wp2.add(vec3(8.3, 2.8, 0)));
127
+ const wy2 = mx_noise_float(wp2.add(vec3(3.1, 7.4, 0)));
128
+ uv$1.assign(uv$1.add(vec2(wx2, wy2).mul(.2).mul(distortion)));
129
+ const zoneNoise = mx_noise_float(vec3(uv$1.x.mul(1.8), uv$1.y.mul(1.8), t.mul(.3).add(seedOff)));
130
+ const edgeHardness = pow(wx1.mul(.5).add(.5), float(1.5));
131
+ const edgeWidth = mix(float(.5), float(.008), edgeHardness);
132
+ const t1 = smoothstep(edgeWidth.negate(), edgeWidth, zoneNoise);
133
+ const t2 = smoothstep(edgeWidth.negate(), edgeWidth, wy1);
134
+ const baseColor = mixColors(mixColors(colorA, colorB, t1, csMode), mixColors(colorC, colorD, t1, csMode), t2, csMode);
135
+ const foldMask1 = float(1).sub(abs(t1.mul(2).sub(1)));
136
+ const foldMask2 = float(1).sub(abs(t2.mul(2).sub(1)));
137
+ const foldHighlight = foldMask1.max(foldMask2).mul(edgeHardness);
138
+ const surfaceLight = wx2.mul(.5).add(.5).mul(.12).add(.94);
139
+ const baseAlpha = baseColor.w;
140
+ return vec4(clamp(baseColor.rgb.mul(surfaceLight).mul(float(1).add(foldHighlight.mul(.35))), 0, 1), baseAlpha);
141
+ })();
142
+ }
143
+ };
144
+ var FlowingGradient_default = componentDefinition;
145
+ export { componentDefinition as n, FlowingGradient_default as t };
@@ -0,0 +1,228 @@
1
+ import { t as applyEdgeHandling } from "./edges-CfGcQniB.js";
2
+ import { c as transformEdges } from "./transformations-B5lM6fYX.js";
3
+ import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
4
+ import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
5
+ import { convertToTexture, float, screenUV, texture, vec2, vec4 } from "three/tsl";
6
+ var GRID_SIZE = 64;
7
+ const componentDefinition = {
8
+ name: "Liquify",
9
+ category: "Interactive",
10
+ description: "Liquid-like interactive deformation effect",
11
+ requiresRTT: true,
12
+ requiresChild: true,
13
+ props: {
14
+ intensity: {
15
+ default: 10,
16
+ description: "Scale of the fabric displacement effect",
17
+ ui: {
18
+ type: ["range", "map"],
19
+ min: 0,
20
+ max: 20,
21
+ step: .1,
22
+ label: "Intensity",
23
+ group: "Effect"
24
+ }
25
+ },
26
+ stiffness: {
27
+ default: 3,
28
+ description: "Fabric rigidity (higher = stiffer canvas, lower = stretchy silk)",
29
+ ui: {
30
+ type: "range",
31
+ min: 1,
32
+ max: 30,
33
+ step: .5,
34
+ label: "Stiffness",
35
+ group: "Effect"
36
+ }
37
+ },
38
+ damping: {
39
+ default: 3,
40
+ description: "How quickly fabric motion settles",
41
+ ui: {
42
+ type: "range",
43
+ min: 0,
44
+ max: 10,
45
+ step: .1,
46
+ label: "Damping",
47
+ group: "Effect"
48
+ }
49
+ },
50
+ radius: {
51
+ default: 1,
52
+ description: "Cursor influence area",
53
+ ui: {
54
+ type: "range",
55
+ min: .1,
56
+ max: 1.5,
57
+ step: .1,
58
+ label: "Radius",
59
+ group: "Effect"
60
+ }
61
+ },
62
+ edges: {
63
+ default: "stretch",
64
+ description: "How to handle edges when distortion pushes content out of bounds",
65
+ transform: transformEdges,
66
+ compileTime: true,
67
+ ui: {
68
+ type: "select",
69
+ options: [
70
+ {
71
+ label: "Stretch",
72
+ value: "stretch"
73
+ },
74
+ {
75
+ label: "Transparent",
76
+ value: "transparent"
77
+ },
78
+ {
79
+ label: "Mirror",
80
+ value: "mirror"
81
+ },
82
+ {
83
+ label: "Wrap",
84
+ value: "wrap"
85
+ }
86
+ ],
87
+ label: "Edges",
88
+ group: "Effect"
89
+ }
90
+ }
91
+ },
92
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions }) => {
93
+ const displacementX = new Float32Array(GRID_SIZE * GRID_SIZE);
94
+ const displacementY = new Float32Array(GRID_SIZE * GRID_SIZE);
95
+ const velocityX = new Float32Array(GRID_SIZE * GRID_SIZE);
96
+ const velocityY = new Float32Array(GRID_SIZE * GRID_SIZE);
97
+ const tempVelocityX = new Float32Array(GRID_SIZE * GRID_SIZE);
98
+ const tempVelocityY = new Float32Array(GRID_SIZE * GRID_SIZE);
99
+ const tempDisplacementX = new Float32Array(GRID_SIZE * GRID_SIZE);
100
+ const tempDisplacementY = new Float32Array(GRID_SIZE * GRID_SIZE);
101
+ const displacementData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
102
+ const displacementTexture = new DataTexture(displacementData, GRID_SIZE, GRID_SIZE, RGFormat, FloatType);
103
+ displacementTexture.magFilter = LinearFilter;
104
+ displacementTexture.minFilter = LinearFilter;
105
+ displacementTexture.needsUpdate = true;
106
+ const displacementField = texture(displacementTexture);
107
+ let prevX = .5;
108
+ let prevY = .5;
109
+ let lastTime = Date.now();
110
+ const SUBSTEPS = 2;
111
+ onBeforeRender(({ pointer }) => {
112
+ const currentTime = Date.now();
113
+ const dt = Math.min((currentTime - lastTime) / 1e3, .016);
114
+ lastTime = currentTime;
115
+ if (dt <= 0) return;
116
+ const aspect = dimensions.width / dimensions.height;
117
+ const stiffness = uniforms.stiffness.uniform.value;
118
+ const damping = uniforms.damping.uniform.value;
119
+ const radius = uniforms.radius.uniform.value * .08;
120
+ const rawVelX = (pointer.x - prevX) / dt;
121
+ const rawVelY = (pointer.y - prevY) / dt;
122
+ const speed = Math.sqrt(rawVelX * rawVelX + rawVelY * rawVelY);
123
+ const clampedSpeed = Math.min(speed, 3);
124
+ let dirX = 0;
125
+ let dirY = 0;
126
+ if (speed > .01) {
127
+ dirX = rawVelX / speed;
128
+ dirY = rawVelY / speed;
129
+ }
130
+ const subDt = dt / SUBSTEPS;
131
+ for (let s = 0; s < SUBSTEPS; s++) {
132
+ if (s === 0 && clampedSpeed > .01) {
133
+ const influenceRadius = radius * 3;
134
+ const minI = Math.max(1, Math.floor((pointer.y - influenceRadius) * GRID_SIZE));
135
+ const maxI = Math.min(GRID_SIZE - 2, Math.ceil((pointer.y + influenceRadius) * GRID_SIZE));
136
+ const minJ = Math.max(1, Math.floor((pointer.x - influenceRadius) * GRID_SIZE));
137
+ const maxJ = Math.min(GRID_SIZE - 2, Math.ceil((pointer.x + influenceRadius) * GRID_SIZE));
138
+ for (let i = minI; i <= maxI; i++) for (let j = minJ; j <= maxJ; j++) {
139
+ const idx = i * GRID_SIZE + j;
140
+ const cellX = (j + .5) / GRID_SIZE;
141
+ const cellY = (i + .5) / GRID_SIZE;
142
+ const ddx = aspect >= 1 ? (cellX - pointer.x) * aspect : cellX - pointer.x;
143
+ const ddy = aspect >= 1 ? cellY - pointer.y : (cellY - pointer.y) / aspect;
144
+ const dist = Math.sqrt(ddx * ddx + ddy * ddy);
145
+ if (dist < influenceRadius) {
146
+ const forceMag = Math.exp(-dist * dist / (radius * radius)) * clampedSpeed * dt * 2;
147
+ velocityX[idx] += dirX * forceMag;
148
+ velocityY[idx] += dirY * forceMag;
149
+ }
150
+ }
151
+ }
152
+ const dampFactor = Math.max(0, Math.min(1, 1 - damping * subDt));
153
+ const shearK = stiffness * .35;
154
+ tempVelocityX.set(velocityX);
155
+ tempVelocityY.set(velocityY);
156
+ tempDisplacementX.set(displacementX);
157
+ tempDisplacementY.set(displacementY);
158
+ for (let i = 1; i < GRID_SIZE - 1; i++) for (let j = 1; j < GRID_SIZE - 1; j++) {
159
+ const idx = i * GRID_SIZE + j;
160
+ let fx = 0;
161
+ let fy = 0;
162
+ const idxL = idx - 1;
163
+ const idxR = idx + 1;
164
+ const idxU = idx - GRID_SIZE;
165
+ const idxD = idx + GRID_SIZE;
166
+ fx += stiffness * (displacementX[idxL] - displacementX[idx]);
167
+ fx += stiffness * (displacementX[idxR] - displacementX[idx]);
168
+ fx += stiffness * (displacementX[idxU] - displacementX[idx]);
169
+ fx += stiffness * (displacementX[idxD] - displacementX[idx]);
170
+ fy += stiffness * (displacementY[idxL] - displacementY[idx]);
171
+ fy += stiffness * (displacementY[idxR] - displacementY[idx]);
172
+ fy += stiffness * (displacementY[idxU] - displacementY[idx]);
173
+ fy += stiffness * (displacementY[idxD] - displacementY[idx]);
174
+ const idxUL = idx - GRID_SIZE - 1;
175
+ const idxUR = idx - GRID_SIZE + 1;
176
+ const idxDL = idx + GRID_SIZE - 1;
177
+ const idxDR = idx + GRID_SIZE + 1;
178
+ fx += shearK * (displacementX[idxUL] - displacementX[idx]);
179
+ fx += shearK * (displacementX[idxUR] - displacementX[idx]);
180
+ fx += shearK * (displacementX[idxDL] - displacementX[idx]);
181
+ fx += shearK * (displacementX[idxDR] - displacementX[idx]);
182
+ fy += shearK * (displacementY[idxUL] - displacementY[idx]);
183
+ fy += shearK * (displacementY[idxUR] - displacementY[idx]);
184
+ fy += shearK * (displacementY[idxDL] - displacementY[idx]);
185
+ fy += shearK * (displacementY[idxDR] - displacementY[idx]);
186
+ fx -= stiffness * .1 * displacementX[idx];
187
+ fy -= stiffness * .1 * displacementY[idx];
188
+ tempVelocityX[idx] = velocityX[idx] * dampFactor + fx * subDt;
189
+ tempVelocityY[idx] = velocityY[idx] * dampFactor + fy * subDt;
190
+ tempDisplacementX[idx] = displacementX[idx] + tempVelocityX[idx] * subDt;
191
+ tempDisplacementY[idx] = displacementY[idx] + tempVelocityY[idx] * subDt;
192
+ tempDisplacementX[idx] = Math.max(-.5, Math.min(.5, tempDisplacementX[idx]));
193
+ tempDisplacementY[idx] = Math.max(-.5, Math.min(.5, tempDisplacementY[idx]));
194
+ }
195
+ velocityX.set(tempVelocityX);
196
+ velocityY.set(tempVelocityY);
197
+ displacementX.set(tempDisplacementX);
198
+ displacementY.set(tempDisplacementY);
199
+ }
200
+ for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
201
+ const idx = i * GRID_SIZE + j;
202
+ const dIdx = idx * 2;
203
+ displacementData[dIdx] = displacementX[idx];
204
+ displacementData[dIdx + 1] = displacementY[idx];
205
+ }
206
+ displacementTexture.needsUpdate = true;
207
+ prevX = pointer.x;
208
+ prevY = pointer.y;
209
+ });
210
+ onCleanup(() => {
211
+ displacementTexture.dispose();
212
+ });
213
+ if (!childNode) return vec4(0, 0, 0, 0);
214
+ const childTexture = convertToTexture(childNode);
215
+ onCleanup(() => {
216
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
217
+ });
218
+ const displacement = displacementField.sample(screenUV).xy;
219
+ const intensityScale = uniforms.intensity.uniform.mul(.1);
220
+ const scaledDisplacement = displacement.mul(intensityScale);
221
+ const maxDisp = float(.15);
222
+ const clampedDisplacement = scaledDisplacement.clamp(vec2(maxDisp.negate(), maxDisp.negate()), vec2(maxDisp, maxDisp));
223
+ const distortedUV = screenUV.sub(clampedDisplacement);
224
+ return unpremultiplyAlpha(applyEdgeHandling(distortedUV, childTexture.sample(distortedUV), childTexture, uniforms.edges.uniform.value));
225
+ }
226
+ };
227
+ var Liquify_default = componentDefinition;
228
+ export { componentDefinition as n, Liquify_default as t };
@@ -1,4 +1,4 @@
1
- import { t as needsVideoCanvasWorkaround } from "./browser-daS5XZwr.js";
1
+ import { t as needsVideoCanvasWorkaround } from "./browser-CqdrcD5J.js";
2
2
  import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
3
3
  import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
@@ -1,4 +1,4 @@
1
- import { t as needsVideoCanvasWorkaround } from "./browser-daS5XZwr.js";
1
+ import { t as needsVideoCanvasWorkaround } from "./browser-CqdrcD5J.js";
2
2
  import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
3
3
  import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
@@ -35,67 +35,68 @@ import "./FilmGrain-CSuerGc6.js";
35
35
  import "./FloatingParticles-CoBM_CJ8.js";
36
36
  import "./Flower-B-53jiUT.js";
37
37
  import "./FlowField-Bh3-dX6I.js";
38
- import "./Form3D-D3MoN95S.js";
39
- import "./Glass-CRaFJ-8c.js";
40
- import "./GlassTiles-C3PKMWgp.js";
41
- import "./Glitch-MyIU0Bad.js";
42
- import "./Glow-1ee_R1fA.js";
43
- import "./Godrays-CvcPIegU.js";
44
- import "./Grayscale-8MPw9PHN.js";
45
- import "./Grid-D64zkkku.js";
46
- import "./GridDistortion-B7PGORW3.js";
47
- import "./Group-DoOcKuhW.js";
48
- import "./Halftone-Co7P2SWy.js";
49
- import "./HueShift-Bvd9VTak.js";
50
- import "./ImageTexture-BJ1udc62.js";
51
- import "./Invert-5VR-fNRw.js";
52
- import "./Kaleidoscope-B0McCEhc.js";
53
- import "./LensFlare-DXgpPyJK.js";
54
- import "./LinearBlur-CBl0B23J.js";
55
- import "./LinearGradient-C0FT7-Lc.js";
56
- import "./Liquify-Cy6ck3_k.js";
57
- import "./Mirror-DfZBEOUf.js";
58
- import "./Neon-E8whPM6C.js";
59
- import "./Paper-DJwBbPxA.js";
60
- import "./Perspective-BdHcCgqZ.js";
61
- import "./Pixelate-B9x2E0k-.js";
62
- import "./Plasma-CMXrHMJv.js";
63
- import "./PolarCoordinates-tZbl0VOq.js";
64
- import "./Polygon-B4ab2iAo.js";
65
- import "./Posterize-Big6cECo.js";
66
- import "./ProgressiveBlur-D0ZlHOw4.js";
67
- import "./RadialGradient-C1Uu5_bL.js";
68
- import "./RectangularCoordinates-BB7_S4gH.js";
69
- import "./Ring-DVW66Ug0.js";
70
- import "./Ripples-DeRyNukC.js";
71
- import "./RoundedRect-B9y33WS5.js";
72
- import "./Saturation-NrGhLp0a.js";
73
- import "./Sharpness-DAC9Qnh0.js";
74
- import "./Shatter-ZIaXf4fs.js";
75
- import "./SimplexNoise-mSsE7oXX.js";
76
- import "./SineWave-BAhTQVXp.js";
77
- import "./SolidColor-BQnId3qy.js";
78
- import "./Spherize-YvHlKrZy.js";
79
- import "./Spiral-DUDZyQjj.js";
80
- import "./Star-DB4dmzyz.js";
81
- import "./Strands-CF49kt1s.js";
82
- import "./Stretch-Dkhera5t.js";
83
- import "./Stripes-BOROXiAH.js";
84
- import "./StudioBackground-DNmf8LGj.js";
85
- import "./Swirl-C5RQIA6E.js";
86
- import "./TiltShift-BgscLSg_.js";
87
- import "./Tint-CvKUJTtg.js";
88
- import "./Trapezoid-Co8cWZTK.js";
89
- import "./Tritone-Ss5m7yFO.js";
90
- import "./Twirl-CF_9ObSp.js";
91
- import "./Vesica-C7tcbHbW.js";
92
- import "./Vibrance-DVWcESAa.js";
93
- import "./browser-daS5XZwr.js";
94
- import "./VideoTexture-DDnc6aVv.js";
95
- import "./WaveDistortion-Caj3cQz7.js";
96
- import "./WebcamTexture-rb0dLKSc.js";
97
- import "./ZoomBlur-DUrSxwl0.js";
98
- import { t as getAllShaders } from "./shaderRegistry-9huRXSRI.js";
38
+ import "./FlowingGradient-DVproCI1.js";
39
+ import "./Form3D-DhezVuyN.js";
40
+ import "./Glass-D7wAPADg.js";
41
+ import "./GlassTiles-ClrOIpCg.js";
42
+ import "./Glitch-DmWytiRl.js";
43
+ import "./Glow-Dm4dfZ_m.js";
44
+ import "./Godrays-CYILZUHg.js";
45
+ import "./Grayscale-CPR_l4G2.js";
46
+ import "./Grid-CCQZ3GhD.js";
47
+ import "./GridDistortion-oGT8NaWa.js";
48
+ import "./Group-CC317vlL.js";
49
+ import "./Halftone-BZk1Hjz_.js";
50
+ import "./HueShift-CuE3YTBE.js";
51
+ import "./ImageTexture-DWUSKXX0.js";
52
+ import "./Invert-C9RiDYP_.js";
53
+ import "./Kaleidoscope-DtVlQWKG.js";
54
+ import "./LensFlare-AVpiDD1O.js";
55
+ import "./LinearBlur-AR65FcZh.js";
56
+ import "./LinearGradient-DXCXjS-K.js";
57
+ import "./Liquify-mhzPd19o.js";
58
+ import "./Mirror-CSc5mJi1.js";
59
+ import "./Neon-By5OgQ24.js";
60
+ import "./Paper-DfUka0dt.js";
61
+ import "./Perspective-uPiPmWy_.js";
62
+ import "./Pixelate-DRkAW4Lo.js";
63
+ import "./Plasma-ELzbK-Us.js";
64
+ import "./PolarCoordinates-CalS_TB6.js";
65
+ import "./Polygon-MN_gj5R6.js";
66
+ import "./Posterize-C4vtRmtA.js";
67
+ import "./ProgressiveBlur-CLYhfOvQ.js";
68
+ import "./RadialGradient-DtD8HWdM.js";
69
+ import "./RectangularCoordinates-B96mflF5.js";
70
+ import "./Ring-76XLaaus.js";
71
+ import "./Ripples-Cevf-Hvg.js";
72
+ import "./RoundedRect-D6q6xf_O.js";
73
+ import "./Saturation-CcDwPh2v.js";
74
+ import "./Sharpness-D_dXfDEo.js";
75
+ import "./Shatter-NfZzVt54.js";
76
+ import "./SimplexNoise-aipzNV5j.js";
77
+ import "./SineWave-CVeYx3n-.js";
78
+ import "./SolidColor-BdbBnLxX.js";
79
+ import "./Spherize-BRGwLGeu.js";
80
+ import "./Spiral-BkTBXb7z.js";
81
+ import "./Star-DN6qziUO.js";
82
+ import "./Strands-Cjsw-cPu.js";
83
+ import "./Stretch-9cta3Z1W.js";
84
+ import "./Stripes-C0sCGCz_.js";
85
+ import "./StudioBackground-BYv_-8df.js";
86
+ import "./Swirl-DXjIXfy7.js";
87
+ import "./TiltShift-56lcZ4cJ.js";
88
+ import "./Tint-8_WIy9_e.js";
89
+ import "./Trapezoid-C-HfI0fp.js";
90
+ import "./Tritone-nyJyybHI.js";
91
+ import "./Twirl-BzSEz4xK.js";
92
+ import "./Vesica-DXWePxDj.js";
93
+ import "./Vibrance-BETLN3Ie.js";
94
+ import "./browser-CqdrcD5J.js";
95
+ import "./VideoTexture-Dbsbgb1Y.js";
96
+ import "./WaveDistortion-C-j597Jm.js";
97
+ import "./WebcamTexture-xvb8MuFz.js";
98
+ import "./ZoomBlur-DFw0J9x3.js";
99
+ import { t as getAllShaders } from "./shaderRegistry-C0Tmid5z.js";
99
100
  import { Material, Mesh, MeshBasicNodeMaterial, OrthographicCamera, PlaneGeometry, SRGBColorSpace, Scene, Vector2, WebGPURenderer } from "three/webgpu";
100
101
  import { WebGLRenderer } from "three";
101
102
  import { PI, abs, add, atan, clamp, convertToTexture, cos, div, dot, float, fract, max, min, mix, mul, pow, screenUV, sign, sin, smoothstep, sqrt, step, sub, time, uniform, uv, vec2, vec3, vec4 } from "three/tsl";
@@ -741,6 +742,9 @@ function shaderRenderer() {
741
742
  const performanceTracker = new PerformanceTracker();
742
743
  let pendingRegistrationQueue = [];
743
744
  let isRendererReady = false;
745
+ let onReadyCallback = null;
746
+ let hasEmittedReady = false;
747
+ let firstRenderPending = false;
744
748
  let materialUpdateBatchRAF = null;
745
749
  let lastComposedNodes = /* @__PURE__ */ new Set();
746
750
  let activeRTTNodes = /* @__PURE__ */ new Set();
@@ -883,6 +887,7 @@ function shaderRenderer() {
883
887
  material = newMaterial;
884
888
  needsMaterialRefresh = false;
885
889
  lastComposedNodes = currentComposedNodes;
890
+ if (!hasEmittedReady && currentComposedNodes.size > 0) firstRenderPending = true;
886
891
  }
887
892
  }
888
893
  } catch (error) {
@@ -1757,6 +1762,11 @@ function shaderRenderer() {
1757
1762
  if (isUpdatingMaterial) return;
1758
1763
  if (enablePerformanceTracking) performance.mark("shader-gpu-start");
1759
1764
  renderer.render(scene, camera);
1765
+ if (firstRenderPending && !hasEmittedReady) {
1766
+ hasEmittedReady = true;
1767
+ firstRenderPending = false;
1768
+ if (onReadyCallback) queueMicrotask(onReadyCallback);
1769
+ }
1760
1770
  executeAfterRenderCallbacks(cappedDeltaTime);
1761
1771
  if (enablePerformanceTracking) {
1762
1772
  performance.mark("shader-gpu-end");
@@ -2077,6 +2087,9 @@ function shaderRenderer() {
2077
2087
  pointerY = .5;
2078
2088
  pointerActive = false;
2079
2089
  pendingNodeRemoval = false;
2090
+ onReadyCallback = null;
2091
+ hasEmittedReady = false;
2092
+ firstRenderPending = false;
2080
2093
  };
2081
2094
  const getRendererType = () => {
2082
2095
  if (!renderer) return null;
@@ -2101,6 +2114,9 @@ function shaderRenderer() {
2101
2114
  getNodeRegistry: () => ({ nodes: new Map(nodeRegistry.nodes) }),
2102
2115
  getRendererType,
2103
2116
  getInternalRenderer: () => renderer ?? null,
2117
+ setOnReady: (callback) => {
2118
+ onReadyCallback = callback;
2119
+ },
2104
2120
  __testing: {
2105
2121
  needsTransformation,
2106
2122
  findChildNodes,