shaders 2.5.94 → 2.5.95

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 (233) hide show
  1. package/dist/core/{Blur-DTyNQt1R.js → Blur-CC8fo0C5.js} +28 -3
  2. package/dist/core/{ChannelBlur-CCaPXjka.js → ChannelBlur-CN_Zyiur.js} +37 -2
  3. package/dist/core/{Crescent-DPxGWdPH.js → Crescent-BkRt-XWy.js} +1 -1
  4. package/dist/core/{Cross-CDyzf8TT.js → Cross-kkY7feuC.js} +1 -1
  5. package/dist/core/{Crystal-DSuN8TNY.js → Crystal-xVyUhVD-.js} +1 -1
  6. package/dist/core/CursorRipples-Cgm7N0Bp.js +289 -0
  7. package/dist/core/CursorTrail-CCRbdwHJ.js +263 -0
  8. package/dist/core/{Ellipse-BNmzdnpK.js → Ellipse-CXxGqTYI.js} +1 -1
  9. package/dist/core/{Emboss-nrduRrVs.js → Emboss-ClQV27Mt.js} +1 -1
  10. package/dist/core/{Flower-B4xPp0Qa.js → Flower-MAwlZEv8.js} +1 -1
  11. package/dist/core/{Glass-CRfTkmRy.js → Glass-gQCmJlsQ.js} +46 -8
  12. package/dist/core/{Glow-CKWIRcBt.js → Glow-DvN-WnB4.js} +32 -2
  13. package/dist/core/GridDistortion-DtaRNrTZ.js +278 -0
  14. package/dist/core/Liquify-cE5dxrfh.js +351 -0
  15. package/dist/core/{Neon-CUKnkAK8.js → Neon-Dg8UfC7P.js} +1 -1
  16. package/dist/core/{Polygon-C1y6Nyh4.js → Polygon-DRCs3CYs.js} +1 -1
  17. package/dist/core/{ProgressiveBlur-BcHBSVDo.js → ProgressiveBlur-Dm530r0z.js} +59 -2
  18. package/dist/core/{Ring-Chj1tp_P.js → Ring-QApyKPzE.js} +1 -1
  19. package/dist/core/{RoundedRect-BEj6tE1e.js → RoundedRect-Ca9af9xe.js} +1 -1
  20. package/dist/core/{Shatter-CZMOHj60.js → Shatter-BssZTRYJ.js} +154 -66
  21. package/dist/core/{Star-fPw1j10r.js → Star-DiXwnPGP.js} +1 -1
  22. package/dist/core/{TiltShift-BysRsV8v.js → TiltShift-BqKaU3TM.js} +60 -2
  23. package/dist/core/{Trapezoid-Cr61vRvN.js → Trapezoid-BX_hmeZJ.js} +1 -1
  24. package/dist/core/{Vesica-AXTA8DJU.js → Vesica-DU0f85NG.js} +1 -1
  25. package/dist/core/{VideoTexture-BobyGZGr.js → VideoTexture-DJrkry82.js} +1 -1
  26. package/dist/core/{WebcamTexture-BXj7sqND.js → WebcamTexture-Cf8J7JB1.js} +1 -1
  27. package/dist/core/computeBlur-B0KA4n89.js +141 -0
  28. package/dist/core/effects/glass.d.ts +1 -1
  29. package/dist/core/effects/glass.d.ts.map +1 -1
  30. package/dist/core/index.js +172 -121
  31. package/dist/core/registry.js +102 -101
  32. package/dist/core/renderer.d.ts +14 -0
  33. package/dist/core/renderer.d.ts.map +1 -1
  34. package/dist/core/shaderRegistry-DriE1ikS.js +244 -0
  35. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  36. package/dist/core/shaders/Blur/index.js +2 -1
  37. package/dist/core/shaders/BrightnessContrast/index.js +1 -1
  38. package/dist/core/shaders/Bulge/index.js +1 -1
  39. package/dist/core/shaders/CRTScreen/index.js +1 -1
  40. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  41. package/dist/core/shaders/ChannelBlur/index.js +2 -1
  42. package/dist/core/shaders/Checkerboard/index.js +1 -1
  43. package/dist/core/shaders/ChromaFlow/index.js +1 -1
  44. package/dist/core/shaders/ChromaticAberration/index.js +1 -1
  45. package/dist/core/shaders/Circle/index.js +1 -1
  46. package/dist/core/shaders/ConcentricSpin/index.js +1 -1
  47. package/dist/core/shaders/ConicGradient/index.js +1 -1
  48. package/dist/core/shaders/ContourLines/index.js +1 -1
  49. package/dist/core/shaders/Crescent/index.js +2 -2
  50. package/dist/core/shaders/Cross/index.js +2 -2
  51. package/dist/core/shaders/Crystal/index.js +2 -2
  52. package/dist/core/shaders/CursorRipples/index.d.ts.map +1 -1
  53. package/dist/core/shaders/CursorRipples/index.js +1 -1
  54. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  55. package/dist/core/shaders/CursorTrail/index.js +1 -1
  56. package/dist/core/shaders/DOMTexture/index.js +1 -1
  57. package/dist/core/shaders/DiamondGradient/index.js +1 -1
  58. package/dist/core/shaders/DiffuseBlur/index.js +1 -1
  59. package/dist/core/shaders/Dither/index.js +1 -1
  60. package/dist/core/shaders/DotGrid/index.js +1 -1
  61. package/dist/core/shaders/DropShadow/index.js +1 -1
  62. package/dist/core/shaders/Duotone/index.js +1 -1
  63. package/dist/core/shaders/Ellipse/index.js +2 -2
  64. package/dist/core/shaders/Emboss/index.js +2 -2
  65. package/dist/core/shaders/FallingLines/index.js +1 -1
  66. package/dist/core/shaders/FilmGrain/index.js +1 -1
  67. package/dist/core/shaders/FloatingParticles/index.js +1 -1
  68. package/dist/core/shaders/FlowField/index.js +1 -1
  69. package/dist/core/shaders/Flower/index.js +2 -2
  70. package/dist/core/shaders/FlowingGradient/index.js +1 -1
  71. package/dist/core/shaders/Form3D/index.js +1 -1
  72. package/dist/core/shaders/Glass/index.d.ts.map +1 -1
  73. package/dist/core/shaders/Glass/index.js +3 -2
  74. package/dist/core/shaders/GlassTiles/index.js +1 -1
  75. package/dist/core/shaders/Glitch/index.js +1 -1
  76. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  77. package/dist/core/shaders/Glow/index.js +2 -1
  78. package/dist/core/shaders/Godrays/index.js +1 -1
  79. package/dist/core/shaders/Grayscale/index.js +1 -1
  80. package/dist/core/shaders/Grid/index.js +1 -1
  81. package/dist/core/shaders/GridDistortion/index.d.ts.map +1 -1
  82. package/dist/core/shaders/GridDistortion/index.js +1 -1
  83. package/dist/core/shaders/Group/index.js +1 -1
  84. package/dist/core/shaders/Halftone/index.js +1 -1
  85. package/dist/core/shaders/HexGrid/index.js +1 -1
  86. package/dist/core/shaders/HueShift/index.js +1 -1
  87. package/dist/core/shaders/ImageTexture/index.js +1 -1
  88. package/dist/core/shaders/Invert/index.js +1 -1
  89. package/dist/core/shaders/Kaleidoscope/index.js +1 -1
  90. package/dist/core/shaders/LensFlare/index.js +1 -1
  91. package/dist/core/shaders/LinearBlur/index.js +1 -1
  92. package/dist/core/shaders/LinearGradient/index.js +1 -1
  93. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  94. package/dist/core/shaders/Liquify/index.js +1 -1
  95. package/dist/core/shaders/Mirror/index.js +1 -1
  96. package/dist/core/shaders/MultiPointGradient/index.js +1 -1
  97. package/dist/core/shaders/Neon/index.js +2 -2
  98. package/dist/core/shaders/Paper/index.js +1 -1
  99. package/dist/core/shaders/Perspective/index.js +1 -1
  100. package/dist/core/shaders/Pixelate/index.js +1 -1
  101. package/dist/core/shaders/Plasma/index.js +1 -1
  102. package/dist/core/shaders/PolarCoordinates/index.js +1 -1
  103. package/dist/core/shaders/Polygon/index.js +2 -2
  104. package/dist/core/shaders/Posterize/index.js +1 -1
  105. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  106. package/dist/core/shaders/ProgressiveBlur/index.js +2 -1
  107. package/dist/core/shaders/RadialGradient/index.js +1 -1
  108. package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
  109. package/dist/core/shaders/Ring/index.js +2 -2
  110. package/dist/core/shaders/Ripples/index.js +1 -1
  111. package/dist/core/shaders/RoundedRect/index.js +2 -2
  112. package/dist/core/shaders/Saturation/index.js +1 -1
  113. package/dist/core/shaders/Sharpness/index.js +1 -1
  114. package/dist/core/shaders/Shatter/index.d.ts.map +1 -1
  115. package/dist/core/shaders/Shatter/index.js +1 -1
  116. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  117. package/dist/core/shaders/SineWave/index.js +1 -1
  118. package/dist/core/shaders/Solarize/index.js +1 -1
  119. package/dist/core/shaders/SolidColor/index.js +1 -1
  120. package/dist/core/shaders/Spherize/index.js +1 -1
  121. package/dist/core/shaders/Spiral/index.js +1 -1
  122. package/dist/core/shaders/Star/index.js +2 -2
  123. package/dist/core/shaders/Strands/index.js +1 -1
  124. package/dist/core/shaders/Stretch/index.js +1 -1
  125. package/dist/core/shaders/Stripes/index.js +1 -1
  126. package/dist/core/shaders/StudioBackground/index.js +1 -1
  127. package/dist/core/shaders/Swirl/index.js +1 -1
  128. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  129. package/dist/core/shaders/TiltShift/index.js +2 -1
  130. package/dist/core/shaders/Tint/index.js +1 -1
  131. package/dist/core/shaders/Trapezoid/index.js +2 -2
  132. package/dist/core/shaders/Tritone/index.js +1 -1
  133. package/dist/core/shaders/Truchet/index.js +1 -1
  134. package/dist/core/shaders/Twirl/index.js +1 -1
  135. package/dist/core/shaders/Vesica/index.js +2 -2
  136. package/dist/core/shaders/Vibrance/index.js +1 -1
  137. package/dist/core/shaders/VideoTexture/index.js +2 -2
  138. package/dist/core/shaders/Vignette/index.js +1 -1
  139. package/dist/core/shaders/Voronoi/index.js +1 -1
  140. package/dist/core/shaders/WaveDistortion/index.js +1 -1
  141. package/dist/core/shaders/Weave/index.js +1 -1
  142. package/dist/core/shaders/WebcamTexture/index.js +2 -2
  143. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  144. package/dist/core/types.d.ts +29 -0
  145. package/dist/core/types.d.ts.map +1 -1
  146. package/dist/core/utilities/computeBlur.d.ts +50 -0
  147. package/dist/core/utilities/computeBlur.d.ts.map +1 -0
  148. package/dist/js/createShader.js +1 -1
  149. package/dist/react/Shader.js +1 -1
  150. package/dist/registry.js +2 -2
  151. package/dist/solid/engine/Shader.js +1 -1
  152. package/dist/svelte/index.js +1 -1
  153. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  154. package/package.json +1 -1
  155. package/dist/core/CursorRipples-Bo-3LZoC.js +0 -186
  156. package/dist/core/CursorTrail-C-0lpOV1.js +0 -160
  157. package/dist/core/GridDistortion-DXM5MgSc.js +0 -183
  158. package/dist/core/Liquify-CqcAWBwZ.js +0 -228
  159. package/dist/core/shaderRegistry-BzOzMO4V.js +0 -244
  160. /package/dist/core/{BrightnessContrast-BoR9bi58.js → BrightnessContrast-CJTOpQCn.js} +0 -0
  161. /package/dist/core/{Bulge-DN2R75Hp.js → Bulge-Chpbxxzj.js} +0 -0
  162. /package/dist/core/{CRTScreen-DolQEkb1.js → CRTScreen-CTwXU-NX.js} +0 -0
  163. /package/dist/core/{Checkerboard-_IUtUrDv.js → Checkerboard-ucave4-a.js} +0 -0
  164. /package/dist/core/{ChromaFlow-Cq6hDVjX.js → ChromaFlow-BZXyVHtK.js} +0 -0
  165. /package/dist/core/{ChromaticAberration-G8_bwQtD.js → ChromaticAberration-DsMj-vBw.js} +0 -0
  166. /package/dist/core/{Circle--0oHzoCi.js → Circle-QgCuVo44.js} +0 -0
  167. /package/dist/core/{ConcentricSpin-BzxzMieZ.js → ConcentricSpin-Crfxti93.js} +0 -0
  168. /package/dist/core/{ConicGradient-BXXizzIs.js → ConicGradient-CQAPYlQg.js} +0 -0
  169. /package/dist/core/{ContourLines-C0XSJEkE.js → ContourLines-KTHC32hd.js} +0 -0
  170. /package/dist/core/{DOMTexture-Dw3Qakny.js → DOMTexture-D-RkeyMs.js} +0 -0
  171. /package/dist/core/{DiamondGradient-TsOxHjg_.js → DiamondGradient-BC3ugP8a.js} +0 -0
  172. /package/dist/core/{DiffuseBlur-BqIV4JLM.js → DiffuseBlur-eyM1v3ad.js} +0 -0
  173. /package/dist/core/{Dither-D_YF6z03.js → Dither-CDfDotR6.js} +0 -0
  174. /package/dist/core/{DotGrid-CiDt4NmI.js → DotGrid-T9YbgC3V.js} +0 -0
  175. /package/dist/core/{DropShadow-BRoXryDA.js → DropShadow-jMhnYPXZ.js} +0 -0
  176. /package/dist/core/{Duotone-CGHcHB9f.js → Duotone-Bl02WcA2.js} +0 -0
  177. /package/dist/core/{FallingLines-vdw8KxhV.js → FallingLines-CArEXajJ.js} +0 -0
  178. /package/dist/core/{FilmGrain-BqQeKO6Z.js → FilmGrain-Ph73aoC_.js} +0 -0
  179. /package/dist/core/{FloatingParticles-DR5cv6Eh.js → FloatingParticles-BtwGRl_d.js} +0 -0
  180. /package/dist/core/{FlowField-DpP32B1X.js → FlowField-RyqiRxyI.js} +0 -0
  181. /package/dist/core/{FlowingGradient-lSouJxmq.js → FlowingGradient-C0Zoyfd6.js} +0 -0
  182. /package/dist/core/{Form3D-DQD-0zrd.js → Form3D-rKpxb9t3.js} +0 -0
  183. /package/dist/core/{GlassTiles-B7aAvcTQ.js → GlassTiles-k1C4a4u8.js} +0 -0
  184. /package/dist/core/{Glitch-CgmgjLea.js → Glitch-DzPMkBu4.js} +0 -0
  185. /package/dist/core/{Godrays-o-3Im6H1.js → Godrays-DAYmq-BP.js} +0 -0
  186. /package/dist/core/{Grayscale-Bip62olI.js → Grayscale-lYKBBkGY.js} +0 -0
  187. /package/dist/core/{Grid-hwQnF_hs.js → Grid-BJ-nxN3i.js} +0 -0
  188. /package/dist/core/{Group-BexPm4Fb.js → Group-DpozigtX.js} +0 -0
  189. /package/dist/core/{Halftone-onLYU4dF.js → Halftone-BVL2oy37.js} +0 -0
  190. /package/dist/core/{HexGrid-BkqEEgfh.js → HexGrid-D-EmQ4kI.js} +0 -0
  191. /package/dist/core/{HueShift-BldS-av9.js → HueShift-D9K0ynaS.js} +0 -0
  192. /package/dist/core/{ImageTexture-DLCjc5cM.js → ImageTexture-CArkZMfh.js} +0 -0
  193. /package/dist/core/{Invert-C2LI5GXr.js → Invert-DCnwo_Xq.js} +0 -0
  194. /package/dist/core/{Kaleidoscope-CxWjs5jx.js → Kaleidoscope-BytHro3k.js} +0 -0
  195. /package/dist/core/{LensFlare-BNO7tCXH.js → LensFlare-B0vv4x97.js} +0 -0
  196. /package/dist/core/{LinearBlur-Ds6rm8u-.js → LinearBlur-BFewxPjV.js} +0 -0
  197. /package/dist/core/{LinearGradient-BZjDhnZp.js → LinearGradient-BKUf_u7r.js} +0 -0
  198. /package/dist/core/{Mirror-5W3sul9v.js → Mirror-DIle92J8.js} +0 -0
  199. /package/dist/core/{MultiPointGradient-lpUGnrLq.js → MultiPointGradient-DDwac_mm.js} +0 -0
  200. /package/dist/core/{Paper-14yYPnWW.js → Paper-bMSMCeYK.js} +0 -0
  201. /package/dist/core/{Perspective-POVbIGPc.js → Perspective-BmfvQV6W.js} +0 -0
  202. /package/dist/core/{Pixelate-CxUxBDeN.js → Pixelate-Dl26r6IT.js} +0 -0
  203. /package/dist/core/{Plasma-DM9TU0VN.js → Plasma-CJWS1TvX.js} +0 -0
  204. /package/dist/core/{PolarCoordinates-t4Wa00gQ.js → PolarCoordinates-lq6K4WBm.js} +0 -0
  205. /package/dist/core/{Posterize-Dk4DE8Ee.js → Posterize-BjH7Zscm.js} +0 -0
  206. /package/dist/core/{RadialGradient-CSXQIa5L.js → RadialGradient-DiGFPgrn.js} +0 -0
  207. /package/dist/core/{RectangularCoordinates-YaZ_uRXb.js → RectangularCoordinates-COkNDxi0.js} +0 -0
  208. /package/dist/core/{Ripples-wJx2FwJY.js → Ripples-C8Q17Hvz.js} +0 -0
  209. /package/dist/core/{Saturation-B500nPZH.js → Saturation-CgDaiq6n.js} +0 -0
  210. /package/dist/core/{Sharpness-NqY4_gKZ.js → Sharpness-CRXT0D30.js} +0 -0
  211. /package/dist/core/{SimplexNoise-2-J7EbY9.js → SimplexNoise-KfTCAfpL.js} +0 -0
  212. /package/dist/core/{SineWave-OWJVWsI1.js → SineWave-Ckeap_YM.js} +0 -0
  213. /package/dist/core/{Solarize-CEhQxL9Z.js → Solarize-DhtQYYpW.js} +0 -0
  214. /package/dist/core/{SolidColor-Dlzm61ZG.js → SolidColor-6yUkGybH.js} +0 -0
  215. /package/dist/core/{Spherize-CXf4_Mkm.js → Spherize-8LXrGGG_.js} +0 -0
  216. /package/dist/core/{Spiral-CSXNX92f.js → Spiral-Bs7uZrBr.js} +0 -0
  217. /package/dist/core/{Strands-BPVy1zbt.js → Strands-DsAAVemq.js} +0 -0
  218. /package/dist/core/{Stretch-CFAjfvny.js → Stretch-D7P2R5lV.js} +0 -0
  219. /package/dist/core/{Stripes-BSGzno-I.js → Stripes-DF8agIiJ.js} +0 -0
  220. /package/dist/core/{StudioBackground-81AihXcZ.js → StudioBackground-BFeNfwEu.js} +0 -0
  221. /package/dist/core/{Swirl-D_ZvZtDS.js → Swirl-BwezrSAA.js} +0 -0
  222. /package/dist/core/{Tint-C6xN-Qot.js → Tint-BdXlqlzz.js} +0 -0
  223. /package/dist/core/{Tritone-Dk8GcpYo.js → Tritone-BlJ7cchN.js} +0 -0
  224. /package/dist/core/{Truchet-BFd2XYD3.js → Truchet-Bnn0fwbF.js} +0 -0
  225. /package/dist/core/{Twirl-CA0r8U7e.js → Twirl-C5ijhqz1.js} +0 -0
  226. /package/dist/core/{Vibrance-Dq1jBFJb.js → Vibrance-dqIV6GBe.js} +0 -0
  227. /package/dist/core/{Vignette-DB8x78Up.js → Vignette-DB1wO1dm.js} +0 -0
  228. /package/dist/core/{Voronoi-ALXxxHBo.js → Voronoi-C3WIJFWc.js} +0 -0
  229. /package/dist/core/{WaveDistortion-CHb75HO3.js → WaveDistortion-BKma8-Ju.js} +0 -0
  230. /package/dist/core/{Weave-j4CrCig4.js → Weave-xuu_vQ5e.js} +0 -0
  231. /package/dist/core/{ZoomBlur-Cl75kL8E.js → ZoomBlur-UcS2iFT2.js} +0 -0
  232. /package/dist/core/{browser-DIoaEnIX.js → browser-ClWxLlIB.js} +0 -0
  233. /package/dist/core/{sdf-Bux00UoZ.js → sdf-DyC2H_qS.js} +0 -0
@@ -0,0 +1,351 @@
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 { StorageTexture } from "three/webgpu";
5
+ import { DataTexture, FloatType, LinearFilter as LinearFilter$1, RGFormat } from "three";
6
+ import { Fn, If, attributeArray, convertToTexture, float, instanceIndex, screenUV, storageTexture, texture, textureStore, uint, uniform, uvec2, vec2, vec4 } from "three/tsl";
7
+ var GRID_SIZE = 64;
8
+ const componentDefinition = {
9
+ name: "Liquify",
10
+ category: "Interactive",
11
+ description: "Liquid-like interactive deformation effect",
12
+ requiresRTT: true,
13
+ requiresChild: true,
14
+ props: {
15
+ intensity: {
16
+ default: 10,
17
+ description: "Scale of the fabric displacement effect",
18
+ ui: {
19
+ type: ["range", "map"],
20
+ min: 0,
21
+ max: 20,
22
+ step: .1,
23
+ label: "Intensity",
24
+ group: "Effect"
25
+ }
26
+ },
27
+ stiffness: {
28
+ default: 3,
29
+ description: "Fabric rigidity (higher = stiffer canvas, lower = stretchy silk)",
30
+ ui: {
31
+ type: "range",
32
+ min: 1,
33
+ max: 30,
34
+ step: .5,
35
+ label: "Stiffness",
36
+ group: "Effect"
37
+ }
38
+ },
39
+ damping: {
40
+ default: 3,
41
+ description: "How quickly fabric motion settles",
42
+ ui: {
43
+ type: "range",
44
+ min: 0,
45
+ max: 10,
46
+ step: .1,
47
+ label: "Damping",
48
+ group: "Effect"
49
+ }
50
+ },
51
+ radius: {
52
+ default: 1,
53
+ description: "Cursor influence area",
54
+ ui: {
55
+ type: "range",
56
+ min: .1,
57
+ max: 1.5,
58
+ step: .1,
59
+ label: "Radius",
60
+ group: "Effect"
61
+ }
62
+ },
63
+ edges: {
64
+ default: "stretch",
65
+ description: "How to handle edges when distortion pushes content out of bounds",
66
+ transform: transformEdges,
67
+ compileTime: true,
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
+ group: "Effect"
90
+ }
91
+ }
92
+ },
93
+ computeNode: ({ uniforms, onCleanup, dimensions }) => {
94
+ const bufferA = attributeArray(GRID_SIZE * GRID_SIZE, "vec4");
95
+ const bufferB = attributeArray(GRID_SIZE * GRID_SIZE, "vec4");
96
+ const dispTex = new StorageTexture(GRID_SIZE, GRID_SIZE);
97
+ dispTex.type = FloatType;
98
+ const dispTexNode = storageTexture(dispTex);
99
+ onCleanup(() => {
100
+ dispTex.dispose();
101
+ });
102
+ const cursorXU = uniform(.5);
103
+ const cursorYU = uniform(.5);
104
+ const dirXU = uniform(0);
105
+ const dirYU = uniform(0);
106
+ const clampedSpeedU = uniform(0);
107
+ const dtU = uniform(.016);
108
+ const subDtU = uniform(.008);
109
+ const stiffnessU = uniform(3);
110
+ const dampFactorU = uniform(.97);
111
+ const radiusU = uniform(.08);
112
+ const aspectU = uniform(1);
113
+ const gs = uint(GRID_SIZE);
114
+ const gsm1 = uint(GRID_SIZE - 1);
115
+ const buildSpringKernel = (readBuf, writeBuf) => Fn(() => {
116
+ const idx = instanceIndex;
117
+ const j = idx.mod(gs);
118
+ const i = idx.div(gs);
119
+ If(i.greaterThan(uint(0)).and(i.lessThan(gsm1)).and(j.greaterThan(uint(0))).and(j.lessThan(gsm1)), () => {
120
+ const current = readBuf.element(idx);
121
+ const dispX = current.x;
122
+ const dispY = current.y;
123
+ const velX = current.z;
124
+ const velY = current.w;
125
+ const idxL = idx.sub(uint(1));
126
+ const idxR = idx.add(uint(1));
127
+ const idxU = idx.sub(gs);
128
+ const idxD = idx.add(gs);
129
+ const idxUL = idx.sub(gs).sub(uint(1));
130
+ const idxUR = idx.sub(gs).add(uint(1));
131
+ const idxDL = idx.add(gs).sub(uint(1));
132
+ const idxDR = idx.add(gs).add(uint(1));
133
+ const fx = stiffnessU.mul(readBuf.element(idxL).x.sub(dispX).add(readBuf.element(idxR).x.sub(dispX)).add(readBuf.element(idxU).x.sub(dispX)).add(readBuf.element(idxD).x.sub(dispX))).toVar();
134
+ const fy = stiffnessU.mul(readBuf.element(idxL).y.sub(dispY).add(readBuf.element(idxR).y.sub(dispY)).add(readBuf.element(idxU).y.sub(dispY)).add(readBuf.element(idxD).y.sub(dispY))).toVar();
135
+ const shearK = stiffnessU.mul(float(.35));
136
+ fx.assign(fx.add(shearK.mul(readBuf.element(idxUL).x.sub(dispX).add(readBuf.element(idxUR).x.sub(dispX)).add(readBuf.element(idxDL).x.sub(dispX)).add(readBuf.element(idxDR).x.sub(dispX)))));
137
+ fy.assign(fy.add(shearK.mul(readBuf.element(idxUL).y.sub(dispY).add(readBuf.element(idxUR).y.sub(dispY)).add(readBuf.element(idxDL).y.sub(dispY)).add(readBuf.element(idxDR).y.sub(dispY)))));
138
+ fx.assign(fx.sub(stiffnessU.mul(float(.1)).mul(dispX)));
139
+ fy.assign(fy.sub(stiffnessU.mul(float(.1)).mul(dispY)));
140
+ const newVelX = velX.mul(dampFactorU).add(fx.mul(subDtU)).toVar();
141
+ const newVelY = velY.mul(dampFactorU).add(fy.mul(subDtU)).toVar();
142
+ If(clampedSpeedU.greaterThan(float(.01)), () => {
143
+ const cellX = j.toFloat().add(float(.5)).div(float(GRID_SIZE));
144
+ const cellY = i.toFloat().add(float(.5)).div(float(GRID_SIZE));
145
+ const ddx = aspectU.greaterThanEqual(float(1)).select(cellX.sub(cursorXU).mul(aspectU), cellX.sub(cursorXU));
146
+ const ddy = aspectU.greaterThanEqual(float(1)).select(cellY.sub(cursorYU), cellY.sub(cursorYU).div(aspectU));
147
+ const distSq = ddx.mul(ddx).add(ddy.mul(ddy));
148
+ const influenceRadius = radiusU.mul(float(3));
149
+ If(distSq.lessThan(influenceRadius.mul(influenceRadius)), () => {
150
+ const forceMag = distSq.negate().div(radiusU.mul(radiusU)).exp().mul(clampedSpeedU).mul(dtU).mul(float(2));
151
+ newVelX.assign(newVelX.add(dirXU.mul(forceMag)));
152
+ newVelY.assign(newVelY.add(dirYU.mul(forceMag)));
153
+ });
154
+ });
155
+ const newDispX = dispX.add(newVelX.mul(subDtU)).clamp(float(-.5), float(.5));
156
+ const newDispY = dispY.add(newVelY.mul(subDtU)).clamp(float(-.5), float(.5));
157
+ writeBuf.element(idx).assign(vec4(newDispX, newDispY, newVelX, newVelY));
158
+ });
159
+ })().compute(GRID_SIZE * GRID_SIZE, [256]);
160
+ const buildOutputKernel = (srcBuf) => Fn(() => {
161
+ const idx = instanceIndex;
162
+ const j = idx.mod(gs);
163
+ const i = idx.div(gs);
164
+ const cell = srcBuf.element(idx);
165
+ textureStore(dispTexNode, uvec2(j, i), vec4(cell.x, cell.y, float(0), float(1))).toWriteOnly();
166
+ })().compute(GRID_SIZE * GRID_SIZE, [256]);
167
+ const springAtoB = buildSpringKernel(bufferA, bufferB);
168
+ const springBtoA = buildSpringKernel(bufferB, bufferA);
169
+ const outputFromA = buildOutputKernel(bufferA);
170
+ let prevX = .5;
171
+ let prevY = .5;
172
+ let lastTime = Date.now();
173
+ let lastActiveTime = Date.now();
174
+ return {
175
+ outputs: { displacement: dispTex },
176
+ getComputeNodes: (params) => {
177
+ const currentTime = Date.now();
178
+ const dt = Math.min((currentTime - lastTime) / 1e3, .016);
179
+ lastTime = currentTime;
180
+ if (dt <= 0) return null;
181
+ const aspect = dimensions.width / Math.max(dimensions.height, 1);
182
+ const stiffness = uniforms.stiffness.uniform.value;
183
+ const damping = uniforms.damping.uniform.value;
184
+ const radius = uniforms.radius.uniform.value * .08;
185
+ const rawVelX = (params.pointer.x - prevX) / dt;
186
+ const rawVelY = (params.pointer.y - prevY) / dt;
187
+ const speed = Math.sqrt(rawVelX * rawVelX + rawVelY * rawVelY);
188
+ const clampedSpeed = Math.min(speed, 3);
189
+ prevX = params.pointer.x;
190
+ prevY = params.pointer.y;
191
+ if (clampedSpeed > .01) lastActiveTime = currentTime;
192
+ const dampVal = uniforms.damping.uniform.value;
193
+ const settleMs = dampVal > 0 ? Math.min(3e4, 5e3 / dampVal) : 3e4;
194
+ if (currentTime - lastActiveTime > settleMs) return null;
195
+ const subDt = dt / 2;
196
+ cursorXU.value = params.pointer.x;
197
+ cursorYU.value = params.pointer.y;
198
+ dirXU.value = speed > .01 ? rawVelX / speed : 0;
199
+ dirYU.value = speed > .01 ? rawVelY / speed : 0;
200
+ clampedSpeedU.value = clampedSpeed;
201
+ dtU.value = dt;
202
+ subDtU.value = subDt;
203
+ stiffnessU.value = stiffness;
204
+ dampFactorU.value = Math.max(0, Math.min(1, 1 - damping * subDt));
205
+ radiusU.value = radius;
206
+ aspectU.value = aspect;
207
+ return [
208
+ springAtoB,
209
+ springBtoA,
210
+ outputFromA
211
+ ];
212
+ }
213
+ };
214
+ },
215
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions, computeOutputs }) => {
216
+ if (!childNode) return vec4(0, 0, 0, 0);
217
+ const childTexture = computeOutputs?.childTexture ?? convertToTexture(childNode);
218
+ if (!computeOutputs) onCleanup(() => {
219
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
220
+ });
221
+ let displacement;
222
+ if (computeOutputs?.displacement) {
223
+ childTexture.sample(screenUV);
224
+ displacement = texture(computeOutputs.displacement).sample(screenUV).xy;
225
+ } else {
226
+ const displacementX = new Float32Array(GRID_SIZE * GRID_SIZE);
227
+ const displacementY = new Float32Array(GRID_SIZE * GRID_SIZE);
228
+ const velocityX = new Float32Array(GRID_SIZE * GRID_SIZE);
229
+ const velocityY = new Float32Array(GRID_SIZE * GRID_SIZE);
230
+ const tempVelocityX = new Float32Array(GRID_SIZE * GRID_SIZE);
231
+ const tempVelocityY = new Float32Array(GRID_SIZE * GRID_SIZE);
232
+ const tempDisplacementX = new Float32Array(GRID_SIZE * GRID_SIZE);
233
+ const tempDisplacementY = new Float32Array(GRID_SIZE * GRID_SIZE);
234
+ const displacementData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
235
+ const displacementTexture = new DataTexture(displacementData, GRID_SIZE, GRID_SIZE, RGFormat, FloatType);
236
+ displacementTexture.magFilter = LinearFilter$1;
237
+ displacementTexture.minFilter = LinearFilter$1;
238
+ displacementTexture.needsUpdate = true;
239
+ const displacementField = texture(displacementTexture);
240
+ let prevX = .5;
241
+ let prevY = .5;
242
+ let lastTime = Date.now();
243
+ const SUBSTEPS = 2;
244
+ onBeforeRender(({ pointer }) => {
245
+ const currentTime = Date.now();
246
+ const dt = Math.min((currentTime - lastTime) / 1e3, .016);
247
+ lastTime = currentTime;
248
+ if (dt <= 0) return;
249
+ const aspect = dimensions.width / Math.max(dimensions.height, 1);
250
+ const stiffness = uniforms.stiffness.uniform.value;
251
+ const damping = uniforms.damping.uniform.value;
252
+ const radius = uniforms.radius.uniform.value * .08;
253
+ const rawVelX = (pointer.x - prevX) / dt;
254
+ const rawVelY = (pointer.y - prevY) / dt;
255
+ const speed = Math.sqrt(rawVelX * rawVelX + rawVelY * rawVelY);
256
+ const clampedSpeed = Math.min(speed, 3);
257
+ let dirX = 0, dirY = 0;
258
+ if (speed > .01) {
259
+ dirX = rawVelX / speed;
260
+ dirY = rawVelY / speed;
261
+ }
262
+ const subDt = dt / SUBSTEPS;
263
+ for (let s = 0; s < SUBSTEPS; s++) {
264
+ if (s === 0 && clampedSpeed > .01) {
265
+ const influenceRadius = radius * 3;
266
+ const minI = Math.max(1, Math.floor((pointer.y - influenceRadius) * GRID_SIZE));
267
+ const maxI = Math.min(GRID_SIZE - 2, Math.ceil((pointer.y + influenceRadius) * GRID_SIZE));
268
+ const minJ = Math.max(1, Math.floor((pointer.x - influenceRadius) * GRID_SIZE));
269
+ const maxJ = Math.min(GRID_SIZE - 2, Math.ceil((pointer.x + influenceRadius) * GRID_SIZE));
270
+ for (let i = minI; i <= maxI; i++) for (let j = minJ; j <= maxJ; j++) {
271
+ const idx = i * GRID_SIZE + j;
272
+ const cellX = (j + .5) / GRID_SIZE;
273
+ const cellY = (i + .5) / GRID_SIZE;
274
+ const ddx = aspect >= 1 ? (cellX - pointer.x) * aspect : cellX - pointer.x;
275
+ const ddy = aspect >= 1 ? cellY - pointer.y : (cellY - pointer.y) / aspect;
276
+ const dist = Math.sqrt(ddx * ddx + ddy * ddy);
277
+ if (dist < influenceRadius) {
278
+ const forceMag = Math.exp(-dist * dist / (radius * radius)) * clampedSpeed * dt * 2;
279
+ velocityX[idx] += dirX * forceMag;
280
+ velocityY[idx] += dirY * forceMag;
281
+ }
282
+ }
283
+ }
284
+ const dampFactor = Math.max(0, Math.min(1, 1 - damping * subDt));
285
+ const shearK = stiffness * .35;
286
+ tempVelocityX.set(velocityX);
287
+ tempVelocityY.set(velocityY);
288
+ tempDisplacementX.set(displacementX);
289
+ tempDisplacementY.set(displacementY);
290
+ for (let i = 1; i < GRID_SIZE - 1; i++) for (let j = 1; j < GRID_SIZE - 1; j++) {
291
+ const idx = i * GRID_SIZE + j;
292
+ let fx = 0, fy = 0;
293
+ const idxL = idx - 1, idxR = idx + 1;
294
+ const idxU = idx - GRID_SIZE, idxD = idx + GRID_SIZE;
295
+ fx += stiffness * (displacementX[idxL] - displacementX[idx]);
296
+ fx += stiffness * (displacementX[idxR] - displacementX[idx]);
297
+ fx += stiffness * (displacementX[idxU] - displacementX[idx]);
298
+ fx += stiffness * (displacementX[idxD] - displacementX[idx]);
299
+ fy += stiffness * (displacementY[idxL] - displacementY[idx]);
300
+ fy += stiffness * (displacementY[idxR] - displacementY[idx]);
301
+ fy += stiffness * (displacementY[idxU] - displacementY[idx]);
302
+ fy += stiffness * (displacementY[idxD] - displacementY[idx]);
303
+ const idxUL = idx - GRID_SIZE - 1, idxUR = idx - GRID_SIZE + 1;
304
+ const idxDL = idx + GRID_SIZE - 1, idxDR = idx + GRID_SIZE + 1;
305
+ fx += shearK * (displacementX[idxUL] - displacementX[idx]);
306
+ fx += shearK * (displacementX[idxUR] - displacementX[idx]);
307
+ fx += shearK * (displacementX[idxDL] - displacementX[idx]);
308
+ fx += shearK * (displacementX[idxDR] - displacementX[idx]);
309
+ fy += shearK * (displacementY[idxUL] - displacementY[idx]);
310
+ fy += shearK * (displacementY[idxUR] - displacementY[idx]);
311
+ fy += shearK * (displacementY[idxDL] - displacementY[idx]);
312
+ fy += shearK * (displacementY[idxDR] - displacementY[idx]);
313
+ fx -= stiffness * .1 * displacementX[idx];
314
+ fy -= stiffness * .1 * displacementY[idx];
315
+ tempVelocityX[idx] = velocityX[idx] * dampFactor + fx * subDt;
316
+ tempVelocityY[idx] = velocityY[idx] * dampFactor + fy * subDt;
317
+ tempDisplacementX[idx] = displacementX[idx] + tempVelocityX[idx] * subDt;
318
+ tempDisplacementY[idx] = displacementY[idx] + tempVelocityY[idx] * subDt;
319
+ tempDisplacementX[idx] = Math.max(-.5, Math.min(.5, tempDisplacementX[idx]));
320
+ tempDisplacementY[idx] = Math.max(-.5, Math.min(.5, tempDisplacementY[idx]));
321
+ }
322
+ velocityX.set(tempVelocityX);
323
+ velocityY.set(tempVelocityY);
324
+ displacementX.set(tempDisplacementX);
325
+ displacementY.set(tempDisplacementY);
326
+ }
327
+ for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
328
+ const idx = i * GRID_SIZE + j;
329
+ const dIdx = idx * 2;
330
+ displacementData[dIdx] = displacementX[idx];
331
+ displacementData[dIdx + 1] = displacementY[idx];
332
+ }
333
+ displacementTexture.needsUpdate = true;
334
+ prevX = pointer.x;
335
+ prevY = pointer.y;
336
+ });
337
+ onCleanup(() => {
338
+ displacementTexture.dispose();
339
+ });
340
+ displacement = displacementField.sample(screenUV).xy;
341
+ }
342
+ const intensityScale = uniforms.intensity.uniform.mul(.1);
343
+ const scaledDisplacement = displacement.mul(intensityScale);
344
+ const maxDisp = float(.15);
345
+ const clampedDisplacement = scaledDisplacement.clamp(vec2(maxDisp.negate(), maxDisp.negate()), vec2(maxDisp, maxDisp));
346
+ const distortedUV = screenUV.sub(clampedDisplacement);
347
+ return unpremultiplyAlpha(applyEdgeHandling(distortedUV, childTexture.sample(distortedUV), childTexture, uniforms.edges.uniform.value));
348
+ }
349
+ };
350
+ var Liquify_default = componentDefinition;
351
+ export { componentDefinition as n, Liquify_default as t };
@@ -1,5 +1,5 @@
1
1
  import { a as transformColor, l as transformPosition } from "./transformations-B5lM6fYX.js";
2
- import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-Bux00UoZ.js";
2
+ import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-DyC2H_qS.js";
3
3
  import { Fn, atan, clamp, cos, exp, exp2, float, max, mix, pow, screenUV, sin, smoothstep, sqrt, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
4
4
  var _LZ = .7;
5
5
  var _INV_LIGHT_LEN = 1 / Math.sqrt(1 + _LZ * _LZ);
@@ -1,6 +1,6 @@
1
1
  import { a as transformColor, l as transformPosition, o as transformColorSpace, t as colorSpaceOptions } from "./transformations-B5lM6fYX.js";
2
2
  import { t as mixColors } from "./colorMixing-BPpDnR5I.js";
3
- import { c as polygonSdf, t as circleSdf } from "./sdf-Bux00UoZ.js";
3
+ import { c as polygonSdf, t as circleSdf } from "./sdf-DyC2H_qS.js";
4
4
  import { cos, float, mix, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
5
5
  var transformStrokePosition = (value) => {
6
6
  return {
@@ -1,6 +1,7 @@
1
1
  import { l as transformPosition, r as transformAngle } from "./transformations-B5lM6fYX.js";
2
2
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
3
- import { Fn, convertToTexture, cos, float, max, radians, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
3
+ import { n as createVariableGaussianBlurCompute } from "./computeBlur-B0KA4n89.js";
4
+ import { Fn, If, convertToTexture, cos, float, instanceIndex, max, radians, screenUV, sin, smoothstep, texture, textureStore, uint, uniform, uvec2, vec2, vec4, viewportSize } from "three/tsl";
4
5
  const componentDefinition = {
5
6
  name: "ProgressiveBlur",
6
7
  category: "Blurs",
@@ -59,8 +60,64 @@ const componentDefinition = {
59
60
  }
60
61
  }
61
62
  },
62
- fragmentNode: ({ uniforms, childNode, onCleanup }) => {
63
+ computeNode: ({ childNode, onCleanup, dimensions, renderer, uniforms }) => {
64
+ if (!childNode) return null;
65
+ const childTexture = convertToTexture(childNode);
66
+ onCleanup(() => {
67
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
68
+ });
69
+ const dpr = renderer?.getPixelRatio?.() ?? 1;
70
+ const texWidth = Math.round(dimensions.width * dpr);
71
+ const texHeight = Math.round(dimensions.height * dpr);
72
+ const { computeNodes: blurNodes, outputTexture, blurMapWriteNode } = createVariableGaussianBlurCompute(childTexture, texWidth, texHeight, onCleanup);
73
+ const angleU = uniform(0);
74
+ const centerXU = uniform(0);
75
+ const centerYU = uniform(.5);
76
+ const falloffU = uniform(1);
77
+ const maxRadiusU = uniform(18);
78
+ const aspectU = uniform(1);
79
+ const w = uint(texWidth);
80
+ const h = uint(texHeight);
81
+ const fillBlurMap = Fn(() => {
82
+ const idx = instanceIndex;
83
+ const x = idx.mod(w);
84
+ const y = idx.div(w);
85
+ If(y.lessThan(h), () => {
86
+ const u = x.toFloat().add(float(.5)).div(float(texWidth));
87
+ const v = y.toFloat().add(float(.5)).div(float(texHeight));
88
+ const angleRad = angleU.mul(float(Math.PI / 180));
89
+ const cosA = angleRad.cos();
90
+ const sinA = angleRad.sin();
91
+ const direction = vec2(cosA.div(aspectU), sinA);
92
+ const centerPos = vec2(centerXU, float(1).sub(centerYU));
93
+ const centeredUV = vec2(u, v).sub(centerPos);
94
+ const directionalDist = max(float(0), centeredUV.dot(direction));
95
+ const radius = smoothstep(float(0), falloffU, directionalDist).mul(maxRadiusU);
96
+ textureStore(blurMapWriteNode, uvec2(x, y), vec4(radius, float(0), float(0), float(1))).toWriteOnly();
97
+ });
98
+ })().compute(texWidth * texHeight, [256]);
99
+ return {
100
+ outputs: {
101
+ childTexture,
102
+ blurredTexture: outputTexture
103
+ },
104
+ getComputeNodes: () => {
105
+ angleU.value = uniforms.angle.uniform.value;
106
+ centerXU.value = uniforms.center.uniform.value?.x ?? uniforms.center.uniform.x?.value ?? 0;
107
+ centerYU.value = uniforms.center.uniform.value?.y ?? uniforms.center.uniform.y?.value ?? .5;
108
+ falloffU.value = uniforms.falloff.uniform.value;
109
+ aspectU.value = dimensions.width / dimensions.height;
110
+ maxRadiusU.value = uniforms.intensity.uniform.value * .36;
111
+ return [fillBlurMap, ...blurNodes];
112
+ }
113
+ };
114
+ },
115
+ fragmentNode: ({ uniforms, childNode, onCleanup, computeOutputs }) => {
63
116
  if (!childNode) return vec4(0, 0, 0, 0);
117
+ if (computeOutputs?.blurredTexture) {
118
+ const sharp = computeOutputs.childTexture.sample(screenUV);
119
+ return unpremultiplyAlpha(vec4(texture(computeOutputs.blurredTexture).sample(screenUV).rgb, sharp.a));
120
+ }
64
121
  const childTexture = convertToTexture(childNode);
65
122
  onCleanup(() => {
66
123
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
@@ -1,6 +1,6 @@
1
1
  import { a as transformColor, l as transformPosition, o as transformColorSpace, t as colorSpaceOptions } from "./transformations-B5lM6fYX.js";
2
2
  import { t as mixColors } from "./colorMixing-BPpDnR5I.js";
3
- import { l as ringSdf } from "./sdf-Bux00UoZ.js";
3
+ import { l as ringSdf } from "./sdf-DyC2H_qS.js";
4
4
  import { float, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
5
5
  var transformStrokePosition = (value) => {
6
6
  return {
@@ -1,6 +1,6 @@
1
1
  import { a as transformColor, l as transformPosition, o as transformColorSpace, t as colorSpaceOptions } from "./transformations-B5lM6fYX.js";
2
2
  import { t as mixColors } from "./colorMixing-BPpDnR5I.js";
3
- import { u as roundedRectSdf } from "./sdf-Bux00UoZ.js";
3
+ import { u as roundedRectSdf } from "./sdf-DyC2H_qS.js";
4
4
  import { cos, float, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
5
5
  var transformStrokePosition = (value) => {
6
6
  return {