shaders 2.2.42 → 2.2.44

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 (296) hide show
  1. package/dist/core/WebcamTexture-D4Uv7Plz.js +168 -0
  2. package/dist/core/index.d.ts +0 -2
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/index.js +8 -168
  5. package/dist/core/registry.d.ts +10 -0
  6. package/dist/core/registry.d.ts.map +1 -0
  7. package/dist/core/registry.js +166 -0
  8. package/dist/core/shaderRegistry.d.ts.map +1 -1
  9. package/dist/core/shaders/WebcamTexture/index.d.ts +21 -0
  10. package/dist/core/shaders/WebcamTexture/index.d.ts.map +1 -0
  11. package/dist/core/shaders/WebcamTexture/index.js +2 -0
  12. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  13. package/dist/react/AngularBlur.js +144 -0
  14. package/dist/react/Ascii.js +144 -0
  15. package/dist/react/Beam.js +144 -0
  16. package/dist/react/Blob.js +144 -0
  17. package/dist/react/Blur.js +144 -0
  18. package/dist/react/BrightnessContrast.js +144 -0
  19. package/dist/react/Bulge.js +144 -0
  20. package/dist/react/CRTScreen.js +144 -0
  21. package/dist/react/ChannelBlur.js +144 -0
  22. package/dist/react/Checkerboard.js +144 -0
  23. package/dist/react/ChromaFlow.js +144 -0
  24. package/dist/react/ChromaticAberration.js +144 -0
  25. package/dist/react/Circle.js +144 -0
  26. package/dist/react/CursorTrail.js +144 -0
  27. package/dist/react/DiffuseBlur.js +144 -0
  28. package/dist/react/Dither.js +144 -0
  29. package/dist/react/DotGrid.js +144 -0
  30. package/dist/react/Duotone.js +144 -0
  31. package/dist/react/FilmGrain.js +144 -0
  32. package/dist/react/FloatingParticles.js +144 -0
  33. package/dist/react/GlassTiles.js +144 -0
  34. package/dist/react/Glow.js +144 -0
  35. package/dist/react/Godrays.js +144 -0
  36. package/dist/react/Grayscale.js +144 -0
  37. package/dist/react/Grid.js +144 -0
  38. package/dist/react/GridDistortion.js +144 -0
  39. package/dist/react/Group.js +144 -0
  40. package/dist/react/Halftone.js +144 -0
  41. package/dist/react/HueShift.js +144 -0
  42. package/dist/react/ImageTexture.js +144 -0
  43. package/dist/react/Invert.js +144 -0
  44. package/dist/react/LinearBlur.js +144 -0
  45. package/dist/react/LinearGradient.js +144 -0
  46. package/dist/react/Liquify.js +144 -0
  47. package/dist/react/Perspective.js +144 -0
  48. package/dist/react/Pixelate.js +144 -0
  49. package/dist/react/PolarCoordinates.js +144 -0
  50. package/dist/react/Posterize.js +144 -0
  51. package/dist/react/ProgressiveBlur.js +144 -0
  52. package/dist/react/RadialGradient.js +144 -0
  53. package/dist/react/RectangularCoordinates.js +144 -0
  54. package/dist/react/Ripples.js +144 -0
  55. package/dist/react/Saturation.js +144 -0
  56. package/dist/react/Shader.js +166 -0
  57. package/dist/react/Sharpness.js +144 -0
  58. package/dist/react/Shatter.js +144 -0
  59. package/dist/react/SimplexNoise.js +144 -0
  60. package/dist/react/SineWave.js +144 -0
  61. package/dist/react/SolidColor.js +144 -0
  62. package/dist/react/Spherize.js +144 -0
  63. package/dist/react/Spiral.js +144 -0
  64. package/dist/react/Strands.js +144 -0
  65. package/dist/react/Stretch.js +144 -0
  66. package/dist/react/Stripes.js +144 -0
  67. package/dist/react/Swirl.js +144 -0
  68. package/dist/react/TiltShift.js +144 -0
  69. package/dist/react/Tint.js +144 -0
  70. package/dist/react/Tritone.js +144 -0
  71. package/dist/react/Twirl.js +144 -0
  72. package/dist/react/Vibrance.js +144 -0
  73. package/dist/react/WaveDistortion.js +144 -0
  74. package/dist/react/WebcamTexture.js +144 -0
  75. package/dist/react/ZoomBlur.js +144 -0
  76. package/dist/react/components/WebcamTexture.d.ts +31 -0
  77. package/dist/react/components/WebcamTexture.d.ts.map +1 -0
  78. package/dist/react/index.d.ts +1 -0
  79. package/dist/react/index.d.ts.map +1 -1
  80. package/dist/react/index.js +65 -8646
  81. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  82. package/dist/react/utils/generatePresetCode.js +392 -1
  83. package/dist/registry.js +91 -0
  84. package/dist/solid/components/AngularBlur.js +148 -0
  85. package/dist/solid/components/Ascii.js +148 -0
  86. package/dist/solid/components/Beam.js +148 -0
  87. package/dist/solid/components/Blob.js +148 -0
  88. package/dist/solid/components/Blur.js +148 -0
  89. package/dist/solid/components/BrightnessContrast.js +148 -0
  90. package/dist/solid/components/Bulge.js +148 -0
  91. package/dist/solid/components/CRTScreen.js +148 -0
  92. package/dist/solid/components/ChannelBlur.js +148 -0
  93. package/dist/solid/components/Checkerboard.js +148 -0
  94. package/dist/solid/components/ChromaFlow.js +148 -0
  95. package/dist/solid/components/ChromaticAberration.js +148 -0
  96. package/dist/solid/components/Circle.js +148 -0
  97. package/dist/solid/components/CursorTrail.js +148 -0
  98. package/dist/solid/components/DiffuseBlur.js +148 -0
  99. package/dist/solid/components/Dither.js +148 -0
  100. package/dist/solid/components/DotGrid.js +148 -0
  101. package/dist/solid/components/Duotone.js +148 -0
  102. package/dist/solid/components/FilmGrain.js +148 -0
  103. package/dist/solid/components/FloatingParticles.js +148 -0
  104. package/dist/solid/components/GlassTiles.js +148 -0
  105. package/dist/solid/components/Glow.js +148 -0
  106. package/dist/solid/components/Godrays.js +148 -0
  107. package/dist/solid/components/Grayscale.js +148 -0
  108. package/dist/solid/components/Grid.js +148 -0
  109. package/dist/solid/components/GridDistortion.js +148 -0
  110. package/dist/solid/components/Group.js +148 -0
  111. package/dist/solid/components/Halftone.js +148 -0
  112. package/dist/solid/components/HueShift.js +148 -0
  113. package/dist/solid/components/ImageTexture.js +148 -0
  114. package/dist/solid/components/Invert.js +148 -0
  115. package/dist/solid/components/LinearBlur.js +148 -0
  116. package/dist/solid/components/LinearGradient.js +148 -0
  117. package/dist/solid/components/Liquify.js +148 -0
  118. package/dist/solid/components/Perspective.js +148 -0
  119. package/dist/solid/components/Pixelate.js +148 -0
  120. package/dist/solid/components/PolarCoordinates.js +148 -0
  121. package/dist/solid/components/Posterize.js +148 -0
  122. package/dist/solid/components/ProgressiveBlur.js +148 -0
  123. package/dist/solid/components/RadialGradient.js +148 -0
  124. package/dist/solid/components/RectangularCoordinates.js +148 -0
  125. package/dist/solid/components/Ripples.js +148 -0
  126. package/dist/solid/components/Saturation.js +148 -0
  127. package/dist/solid/components/Sharpness.js +148 -0
  128. package/dist/solid/components/Shatter.js +148 -0
  129. package/dist/solid/components/SimplexNoise.js +148 -0
  130. package/dist/solid/components/SineWave.js +148 -0
  131. package/dist/solid/components/SolidColor.js +148 -0
  132. package/dist/solid/components/Spherize.js +148 -0
  133. package/dist/solid/components/Spiral.js +148 -0
  134. package/dist/solid/components/Strands.js +148 -0
  135. package/dist/solid/components/Stretch.js +148 -0
  136. package/dist/solid/components/Stripes.js +148 -0
  137. package/dist/solid/components/Swirl.js +148 -0
  138. package/dist/solid/components/TiltShift.js +148 -0
  139. package/dist/solid/components/Tint.js +148 -0
  140. package/dist/solid/components/Tritone.js +148 -0
  141. package/dist/solid/components/Twirl.js +148 -0
  142. package/dist/solid/components/Vibrance.js +148 -0
  143. package/dist/solid/components/WaveDistortion.js +148 -0
  144. package/dist/solid/components/WebcamTexture.d.ts +28 -0
  145. package/dist/solid/components/WebcamTexture.d.ts.map +1 -0
  146. package/dist/solid/components/WebcamTexture.js +148 -0
  147. package/dist/solid/components/ZoomBlur.js +148 -0
  148. package/dist/solid/engine/Shader.js +189 -0
  149. package/dist/solid/index.d.ts +1 -0
  150. package/dist/solid/index.d.ts.map +1 -1
  151. package/dist/solid/index.js +126 -8847
  152. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  153. package/dist/solid/utils/generatePresetCode.js +66 -414
  154. package/dist/svelte/components/WebcamTexture.svelte.d.ts +19 -0
  155. package/dist/svelte/generatePresetCode-CtXcoyI0.js +393 -0
  156. package/dist/svelte/index.d.ts +1 -0
  157. package/dist/svelte/index.js +115 -4
  158. package/dist/svelte/utils/generatePresetCode.js +1 -1
  159. package/dist/vue/AngularBlur.js +3 -0
  160. package/dist/vue/AngularBlur.vue_vue_type_script_setup_true_lang.js +125 -0
  161. package/dist/vue/Ascii.js +3 -0
  162. package/dist/vue/Ascii.vue_vue_type_script_setup_true_lang.js +127 -0
  163. package/dist/vue/Beam.js +3 -0
  164. package/dist/vue/Beam.vue_vue_type_script_setup_true_lang.js +132 -0
  165. package/dist/vue/Blob.js +3 -0
  166. package/dist/vue/Blob.vue_vue_type_script_setup_true_lang.js +137 -0
  167. package/dist/vue/Blur.js +3 -0
  168. package/dist/vue/Blur.vue_vue_type_script_setup_true_lang.js +124 -0
  169. package/dist/vue/BrightnessContrast.js +3 -0
  170. package/dist/vue/BrightnessContrast.vue_vue_type_script_setup_true_lang.js +125 -0
  171. package/dist/vue/Bulge.js +3 -0
  172. package/dist/vue/Bulge.vue_vue_type_script_setup_true_lang.js +128 -0
  173. package/dist/vue/CRTScreen.js +3 -0
  174. package/dist/vue/CRTScreen.vue_vue_type_script_setup_true_lang.js +129 -0
  175. package/dist/vue/ChannelBlur.js +3 -0
  176. package/dist/vue/ChannelBlur.vue_vue_type_script_setup_true_lang.js +126 -0
  177. package/dist/vue/Checkerboard.js +3 -0
  178. package/dist/vue/Checkerboard.vue_vue_type_script_setup_true_lang.js +128 -0
  179. package/dist/vue/ChromaFlow.js +3 -0
  180. package/dist/vue/ChromaFlow.vue_vue_type_script_setup_true_lang.js +131 -0
  181. package/dist/vue/ChromaticAberration.js +3 -0
  182. package/dist/vue/ChromaticAberration.vue_vue_type_script_setup_true_lang.js +128 -0
  183. package/dist/vue/Circle.js +3 -0
  184. package/dist/vue/Circle.vue_vue_type_script_setup_true_lang.js +127 -0
  185. package/dist/vue/CursorTrail.js +3 -0
  186. package/dist/vue/CursorTrail.vue_vue_type_script_setup_true_lang.js +129 -0
  187. package/dist/vue/DiffuseBlur.js +3 -0
  188. package/dist/vue/DiffuseBlur.vue_vue_type_script_setup_true_lang.js +125 -0
  189. package/dist/vue/Dither.js +3 -0
  190. package/dist/vue/Dither.vue_vue_type_script_setup_true_lang.js +127 -0
  191. package/dist/vue/DotGrid.js +3 -0
  192. package/dist/vue/DotGrid.vue_vue_type_script_setup_true_lang.js +127 -0
  193. package/dist/vue/Duotone.js +3 -0
  194. package/dist/vue/Duotone.vue_vue_type_script_setup_true_lang.js +127 -0
  195. package/dist/vue/FilmGrain.js +3 -0
  196. package/dist/vue/FilmGrain.vue_vue_type_script_setup_true_lang.js +124 -0
  197. package/dist/vue/FloatingParticles.js +3 -0
  198. package/dist/vue/FloatingParticles.vue_vue_type_script_setup_true_lang.js +134 -0
  199. package/dist/vue/GlassTiles.js +3 -0
  200. package/dist/vue/GlassTiles.vue_vue_type_script_setup_true_lang.js +127 -0
  201. package/dist/vue/Glow.js +3 -0
  202. package/dist/vue/Glow.vue_vue_type_script_setup_true_lang.js +126 -0
  203. package/dist/vue/Godrays.js +3 -0
  204. package/dist/vue/Godrays.vue_vue_type_script_setup_true_lang.js +130 -0
  205. package/dist/vue/Grayscale.js +3 -0
  206. package/dist/vue/Grayscale.vue_vue_type_script_setup_true_lang.js +123 -0
  207. package/dist/vue/Grid.js +3 -0
  208. package/dist/vue/Grid.vue_vue_type_script_setup_true_lang.js +126 -0
  209. package/dist/vue/GridDistortion.js +3 -0
  210. package/dist/vue/GridDistortion.vue_vue_type_script_setup_true_lang.js +129 -0
  211. package/dist/vue/Group.js +3 -0
  212. package/dist/vue/Group.vue_vue_type_script_setup_true_lang.js +123 -0
  213. package/dist/vue/Halftone.js +3 -0
  214. package/dist/vue/Halftone.vue_vue_type_script_setup_true_lang.js +126 -0
  215. package/dist/vue/HueShift.js +3 -0
  216. package/dist/vue/HueShift.vue_vue_type_script_setup_true_lang.js +124 -0
  217. package/dist/vue/ImageTexture.js +3 -0
  218. package/dist/vue/ImageTexture.vue_vue_type_script_setup_true_lang.js +125 -0
  219. package/dist/vue/Invert.js +3 -0
  220. package/dist/vue/Invert.vue_vue_type_script_setup_true_lang.js +123 -0
  221. package/dist/vue/LinearBlur.js +3 -0
  222. package/dist/vue/LinearBlur.vue_vue_type_script_setup_true_lang.js +125 -0
  223. package/dist/vue/LinearGradient.js +3 -0
  224. package/dist/vue/LinearGradient.vue_vue_type_script_setup_true_lang.js +130 -0
  225. package/dist/vue/Liquify.js +3 -0
  226. package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +128 -0
  227. package/dist/vue/Perspective.js +3 -0
  228. package/dist/vue/Perspective.vue_vue_type_script_setup_true_lang.js +130 -0
  229. package/dist/vue/Pixelate.js +3 -0
  230. package/dist/vue/Pixelate.vue_vue_type_script_setup_true_lang.js +124 -0
  231. package/dist/vue/PolarCoordinates.js +3 -0
  232. package/dist/vue/PolarCoordinates.vue_vue_type_script_setup_true_lang.js +128 -0
  233. package/dist/vue/Posterize.js +3 -0
  234. package/dist/vue/Posterize.vue_vue_type_script_setup_true_lang.js +124 -0
  235. package/dist/vue/ProgressiveBlur.js +3 -0
  236. package/dist/vue/ProgressiveBlur.vue_vue_type_script_setup_true_lang.js +127 -0
  237. package/dist/vue/RadialGradient.js +3 -0
  238. package/dist/vue/RadialGradient.vue_vue_type_script_setup_true_lang.js +128 -0
  239. package/dist/vue/RectangularCoordinates.js +3 -0
  240. package/dist/vue/RectangularCoordinates.vue_vue_type_script_setup_true_lang.js +127 -0
  241. package/dist/vue/Ripples.js +3 -0
  242. package/dist/vue/Ripples.vue_vue_type_script_setup_true_lang.js +131 -0
  243. package/dist/vue/Saturation.js +3 -0
  244. package/dist/vue/Saturation.vue_vue_type_script_setup_true_lang.js +124 -0
  245. package/dist/vue/Shader.js +3 -0
  246. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +153 -0
  247. package/dist/vue/Sharpness.js +3 -0
  248. package/dist/vue/Sharpness.vue_vue_type_script_setup_true_lang.js +124 -0
  249. package/dist/vue/Shatter.js +3 -0
  250. package/dist/vue/Shatter.vue_vue_type_script_setup_true_lang.js +132 -0
  251. package/dist/vue/SimplexNoise.js +3 -0
  252. package/dist/vue/SimplexNoise.vue_vue_type_script_setup_true_lang.js +130 -0
  253. package/dist/vue/SineWave.js +3 -0
  254. package/dist/vue/SineWave.vue_vue_type_script_setup_true_lang.js +131 -0
  255. package/dist/vue/SolidColor.js +3 -0
  256. package/dist/vue/SolidColor.vue_vue_type_script_setup_true_lang.js +124 -0
  257. package/dist/vue/Spherize.js +3 -0
  258. package/dist/vue/Spherize.vue_vue_type_script_setup_true_lang.js +130 -0
  259. package/dist/vue/Spiral.js +3 -0
  260. package/dist/vue/Spiral.vue_vue_type_script_setup_true_lang.js +132 -0
  261. package/dist/vue/Strands.js +3 -0
  262. package/dist/vue/Strands.vue_vue_type_script_setup_true_lang.js +132 -0
  263. package/dist/vue/Stretch.js +3 -0
  264. package/dist/vue/Stretch.vue_vue_type_script_setup_true_lang.js +128 -0
  265. package/dist/vue/Stripes.js +3 -0
  266. package/dist/vue/Stripes.vue_vue_type_script_setup_true_lang.js +132 -0
  267. package/dist/vue/Swirl.js +3 -0
  268. package/dist/vue/Swirl.vue_vue_type_script_setup_true_lang.js +129 -0
  269. package/dist/vue/TiltShift.js +3 -0
  270. package/dist/vue/TiltShift.vue_vue_type_script_setup_true_lang.js +128 -0
  271. package/dist/vue/Tint.js +3 -0
  272. package/dist/vue/Tint.vue_vue_type_script_setup_true_lang.js +126 -0
  273. package/dist/vue/Tritone.js +3 -0
  274. package/dist/vue/Tritone.vue_vue_type_script_setup_true_lang.js +128 -0
  275. package/dist/vue/Twirl.js +3 -0
  276. package/dist/vue/Twirl.vue_vue_type_script_setup_true_lang.js +126 -0
  277. package/dist/vue/Vibrance.js +3 -0
  278. package/dist/vue/Vibrance.vue_vue_type_script_setup_true_lang.js +124 -0
  279. package/dist/vue/WaveDistortion.js +3 -0
  280. package/dist/vue/WaveDistortion.vue_vue_type_script_setup_true_lang.js +129 -0
  281. package/dist/vue/WebcamTexture.js +3 -0
  282. package/dist/vue/WebcamTexture.vue_vue_type_script_setup_true_lang.js +125 -0
  283. package/dist/vue/ZoomBlur.js +3 -0
  284. package/dist/vue/ZoomBlur.vue_vue_type_script_setup_true_lang.js +125 -0
  285. package/dist/vue/components/WebcamTexture.vue.d.ts +57 -0
  286. package/dist/vue/components/WebcamTexture.vue.d.ts.map +1 -0
  287. package/dist/vue/index.d.ts +1 -0
  288. package/dist/vue/index.d.ts.map +1 -1
  289. package/dist/vue/index.js +65 -7749
  290. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  291. package/dist/vue/utils/generatePresetCode.js +391 -1
  292. package/package.json +9 -1
  293. package/dist/react/generatePresetCode-BrkW1bEe.js +0 -741
  294. package/dist/svelte/generatePresetCode-bx7z5wvC.js +0 -741
  295. package/dist/vue/generatePresetCode-_7ZzqQPH.js +0 -740
  296. /package/dist/core/{ZoomBlur-CTrw7HxX.js → ZoomBlur-CIkkDBIo.js} +0 -0
@@ -1,740 +0,0 @@
1
- function camelToKebab(str) {
2
- return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
3
- }
4
- var DEFAULT_TRANSFORM = {
5
- offsetX: 0,
6
- offsetY: 0,
7
- rotation: 0,
8
- scale: 1,
9
- anchorX: .5,
10
- anchorY: .5,
11
- edges: "transparent"
12
- };
13
- var shaderMetadata = {
14
- "AngularBlur": {
15
- "opacity": 1,
16
- "blendMode": "normal",
17
- "intensity": 20,
18
- "center": {
19
- "x": .5,
20
- "y": .5
21
- }
22
- },
23
- "Ascii": {
24
- "opacity": 1,
25
- "blendMode": "normal",
26
- "characters": "@%#*+=-:.",
27
- "cellSize": 30,
28
- "fontFamily": "JetBrains Mono",
29
- "spacing": 1
30
- },
31
- "Beam": {
32
- "opacity": 1,
33
- "blendMode": "normal",
34
- "startPosition": {
35
- "x": .2,
36
- "y": .5
37
- },
38
- "endPosition": {
39
- "x": .8,
40
- "y": .5
41
- },
42
- "startThickness": .2,
43
- "endThickness": .2,
44
- "startSoftness": .5,
45
- "endSoftness": .5,
46
- "insideColor": "#FF0000",
47
- "outsideColor": "#0000FF",
48
- "colorSpace": "linear"
49
- },
50
- "Blob": {
51
- "opacity": 1,
52
- "blendMode": "normal",
53
- "colorA": "#ff6b35",
54
- "colorB": "#e91e63",
55
- "size": .5,
56
- "deformation": .5,
57
- "softness": .5,
58
- "highlightIntensity": .5,
59
- "highlightX": .3,
60
- "highlightY": -.3,
61
- "highlightZ": .4,
62
- "highlightColor": "#ffe11a",
63
- "speed": .5,
64
- "seed": 1,
65
- "center": {
66
- "x": .5,
67
- "y": .5
68
- },
69
- "colorSpace": "linear"
70
- },
71
- "Blur": {
72
- "opacity": 1,
73
- "blendMode": "normal",
74
- "intensity": 50
75
- },
76
- "BrightnessContrast": {
77
- "opacity": 1,
78
- "blendMode": "normal",
79
- "brightness": 0,
80
- "contrast": 0
81
- },
82
- "Bulge": {
83
- "opacity": 1,
84
- "blendMode": "normal",
85
- "center": {
86
- "x": .5,
87
- "y": .5
88
- },
89
- "strength": 1,
90
- "radius": 1,
91
- "falloff": .5,
92
- "edges": "stretch"
93
- },
94
- "ChannelBlur": {
95
- "opacity": 1,
96
- "blendMode": "normal",
97
- "redIntensity": 0,
98
- "greenIntensity": 20,
99
- "blueIntensity": 40
100
- },
101
- "Checkerboard": {
102
- "opacity": 1,
103
- "blendMode": "normal",
104
- "colorA": "#cccccc",
105
- "colorB": "#999999",
106
- "cells": 8,
107
- "softness": 0,
108
- "colorSpace": "linear"
109
- },
110
- "ChromaFlow": {
111
- "opacity": 1,
112
- "blendMode": "normal",
113
- "baseColor": "#0066ff",
114
- "upColor": "#00ff00",
115
- "downColor": "#ff0000",
116
- "leftColor": "#0000ff",
117
- "rightColor": "#ffff00",
118
- "intensity": 1,
119
- "radius": 2,
120
- "momentum": 30
121
- },
122
- "ChromaticAberration": {
123
- "opacity": 1,
124
- "blendMode": "normal",
125
- "strength": .2,
126
- "angle": 0,
127
- "redOffset": -1,
128
- "greenOffset": 0,
129
- "blueOffset": 1
130
- },
131
- "Circle": {
132
- "opacity": 1,
133
- "blendMode": "normal",
134
- "color": "#ffffff",
135
- "radius": 1,
136
- "softness": 0,
137
- "center": {
138
- "x": .5,
139
- "y": .5
140
- }
141
- },
142
- "CRTScreen": {
143
- "opacity": 1,
144
- "blendMode": "normal",
145
- "pixelSize": 128,
146
- "colorShift": 1,
147
- "scanlineIntensity": .3,
148
- "scanlineFrequency": 200,
149
- "brightness": 1.1,
150
- "contrast": 1.2
151
- },
152
- "CursorTrail": {
153
- "opacity": 1,
154
- "blendMode": "normal",
155
- "colorA": "#00aaff",
156
- "colorB": "#ff00aa",
157
- "radius": .5,
158
- "length": .5,
159
- "shrink": 1,
160
- "colorSpace": "linear"
161
- },
162
- "DiffuseBlur": {
163
- "opacity": 1,
164
- "blendMode": "normal",
165
- "intensity": 30,
166
- "edges": "stretch"
167
- },
168
- "Dither": {
169
- "opacity": 1,
170
- "blendMode": "normal",
171
- "pixelSize": 4,
172
- "threshold": .5,
173
- "colorA": "transparent",
174
- "colorB": "#ffffff"
175
- },
176
- "DotGrid": {
177
- "opacity": 1,
178
- "blendMode": "normal",
179
- "color": "#ffffff",
180
- "density": 100,
181
- "dotSize": .3,
182
- "twinkle": 0
183
- },
184
- "Duotone": {
185
- "opacity": 1,
186
- "blendMode": "normal",
187
- "colorA": "#ff0000",
188
- "colorB": "#023af4",
189
- "blend": .5,
190
- "colorSpace": "linear"
191
- },
192
- "FilmGrain": {
193
- "opacity": 1,
194
- "blendMode": "normal",
195
- "strength": .5
196
- },
197
- "FloatingParticles": {
198
- "opacity": 1,
199
- "blendMode": "normal",
200
- "randomness": .25,
201
- "speed": .25,
202
- "angle": 90,
203
- "particleSize": 1,
204
- "particleSoftness": 0,
205
- "twinkle": .5,
206
- "count": 5,
207
- "particleColor": "#ffffff",
208
- "speedVariance": .3,
209
- "angleVariance": 30,
210
- "particleDensity": 3
211
- },
212
- "GlassTiles": {
213
- "opacity": 1,
214
- "blendMode": "normal",
215
- "intensity": 2,
216
- "tileCount": 20,
217
- "rotation": 0,
218
- "roundness": 0
219
- },
220
- "Glow": {
221
- "opacity": 1,
222
- "blendMode": "normal",
223
- "intensity": 1,
224
- "threshold": .5,
225
- "size": 10
226
- },
227
- "Godrays": {
228
- "opacity": 1,
229
- "blendMode": "normal",
230
- "center": {
231
- "x": 0,
232
- "y": 0
233
- },
234
- "density": .3,
235
- "intensity": .8,
236
- "spotty": 1,
237
- "speed": .5,
238
- "rayColor": "#4283fb",
239
- "backgroundColor": "transparent"
240
- },
241
- "Grayscale": {
242
- "opacity": 1,
243
- "blendMode": "normal"
244
- },
245
- "Grid": {
246
- "opacity": 1,
247
- "blendMode": "normal",
248
- "color": "#ffffff",
249
- "cells": 10,
250
- "thickness": 1
251
- },
252
- "GridDistortion": {
253
- "opacity": 1,
254
- "blendMode": "normal",
255
- "intensity": 1,
256
- "swirl": 0,
257
- "decay": 3,
258
- "radius": 1,
259
- "gridSize": 20,
260
- "edges": "stretch"
261
- },
262
- "Group": {
263
- "opacity": 1,
264
- "blendMode": "normal"
265
- },
266
- "Halftone": {
267
- "opacity": 1,
268
- "blendMode": "normal",
269
- "frequency": 100,
270
- "angle": 45,
271
- "smoothness": .1
272
- },
273
- "HueShift": {
274
- "opacity": 1,
275
- "blendMode": "normal",
276
- "shift": 0
277
- },
278
- "ImageTexture": {
279
- "opacity": 1,
280
- "blendMode": "normal",
281
- "url": "https://shaders.com/sample.jpg",
282
- "objectFit": "cover"
283
- },
284
- "Invert": {
285
- "opacity": 1,
286
- "blendMode": "normal"
287
- },
288
- "LinearBlur": {
289
- "opacity": 1,
290
- "blendMode": "normal",
291
- "intensity": 30,
292
- "angle": 0
293
- },
294
- "LinearGradient": {
295
- "opacity": 1,
296
- "blendMode": "normal",
297
- "colorA": "#1aff00",
298
- "colorB": "#0000ff",
299
- "start": {
300
- "x": 0,
301
- "y": .5
302
- },
303
- "end": {
304
- "x": 1,
305
- "y": .5
306
- },
307
- "angle": 0,
308
- "edges": "stretch",
309
- "colorSpace": "linear"
310
- },
311
- "Liquify": {
312
- "opacity": 1,
313
- "blendMode": "normal",
314
- "intensity": 1,
315
- "swirl": 0,
316
- "decay": 3,
317
- "radius": 1,
318
- "edges": "stretch"
319
- },
320
- "Perspective": {
321
- "opacity": 1,
322
- "blendMode": "normal",
323
- "center": {
324
- "x": .5,
325
- "y": .5
326
- },
327
- "pan": 0,
328
- "tilt": 0,
329
- "fov": 60,
330
- "zoom": 1,
331
- "offset": {
332
- "x": .5,
333
- "y": .5
334
- },
335
- "edges": "transparent"
336
- },
337
- "Pixelate": {
338
- "opacity": 1,
339
- "blendMode": "normal",
340
- "scale": 50
341
- },
342
- "PolarCoordinates": {
343
- "opacity": 1,
344
- "blendMode": "normal",
345
- "center": {
346
- "x": .5,
347
- "y": .5
348
- },
349
- "wrap": 1,
350
- "radius": 1,
351
- "intensity": 1,
352
- "edges": "transparent"
353
- },
354
- "Posterize": {
355
- "opacity": 1,
356
- "blendMode": "normal",
357
- "intensity": 5
358
- },
359
- "ProgressiveBlur": {
360
- "opacity": 1,
361
- "blendMode": "normal",
362
- "intensity": 50,
363
- "angle": 0,
364
- "center": {
365
- "x": 0,
366
- "y": .5
367
- },
368
- "falloff": 1
369
- },
370
- "RadialGradient": {
371
- "opacity": 1,
372
- "blendMode": "normal",
373
- "colorA": "#ff0000",
374
- "colorB": "#0000ff",
375
- "center": {
376
- "x": .5,
377
- "y": .5
378
- },
379
- "radius": 1,
380
- "colorSpace": "linear"
381
- },
382
- "RectangularCoordinates": {
383
- "opacity": 1,
384
- "blendMode": "normal",
385
- "center": {
386
- "x": .5,
387
- "y": .5
388
- },
389
- "scale": 1,
390
- "intensity": 1,
391
- "edges": "transparent"
392
- },
393
- "Ripples": {
394
- "opacity": 1,
395
- "blendMode": "normal",
396
- "center": {
397
- "x": .5,
398
- "y": .5
399
- },
400
- "colorA": "#ffffff",
401
- "colorB": "#000000",
402
- "speed": 1,
403
- "frequency": 20,
404
- "softness": 0,
405
- "thickness": .5,
406
- "phase": 0
407
- },
408
- "Saturation": {
409
- "opacity": 1,
410
- "blendMode": "normal",
411
- "intensity": 1
412
- },
413
- "Sharpness": {
414
- "opacity": 1,
415
- "blendMode": "normal",
416
- "sharpness": 0
417
- },
418
- "Shatter": {
419
- "opacity": 1,
420
- "blendMode": "normal",
421
- "crackWidth": 1,
422
- "intensity": 4,
423
- "radius": .4,
424
- "decay": 1,
425
- "seed": 2,
426
- "chromaticSplit": 1,
427
- "refractionStrength": 5,
428
- "shardLighting": .1,
429
- "edges": "mirror"
430
- },
431
- "SimplexNoise": {
432
- "opacity": 1,
433
- "blendMode": "normal",
434
- "colorA": "#ffffff",
435
- "colorB": "transparent",
436
- "scale": 2,
437
- "balance": 0,
438
- "contrast": 0,
439
- "seed": 0,
440
- "speed": 1
441
- },
442
- "SineWave": {
443
- "opacity": 1,
444
- "blendMode": "normal",
445
- "color": "#ffffff",
446
- "amplitude": .15,
447
- "frequency": 1,
448
- "speed": 1,
449
- "angle": 0,
450
- "position": {
451
- "x": .5,
452
- "y": .5
453
- },
454
- "thickness": .2,
455
- "softness": .4
456
- },
457
- "SolidColor": {
458
- "opacity": 1,
459
- "blendMode": "normal",
460
- "color": "#5b18ca"
461
- },
462
- "Spherize": {
463
- "opacity": 1,
464
- "blendMode": "normal",
465
- "radius": 1,
466
- "depth": 1,
467
- "center": {
468
- "x": .5,
469
- "y": .5
470
- },
471
- "lightPosition": {
472
- "x": .3,
473
- "y": .3
474
- },
475
- "lightIntensity": .5,
476
- "lightSoftness": .5,
477
- "lightColor": "#ffffff"
478
- },
479
- "Spiral": {
480
- "opacity": 1,
481
- "blendMode": "normal",
482
- "colorA": "#000000",
483
- "colorB": "#ffffff",
484
- "strokeWidth": .5,
485
- "strokeFalloff": 0,
486
- "softness": 0,
487
- "speed": 1,
488
- "center": {
489
- "x": .5,
490
- "y": .5
491
- },
492
- "scale": 1,
493
- "colorSpace": "linear"
494
- },
495
- "Strands": {
496
- "opacity": 1,
497
- "blendMode": "normal",
498
- "speed": .5,
499
- "amplitude": 1,
500
- "frequency": 1,
501
- "lineCount": 12,
502
- "lineWidth": .1,
503
- "waveColor": "#f1c907",
504
- "pinEdges": true,
505
- "start": {
506
- "x": 0,
507
- "y": .5
508
- },
509
- "end": {
510
- "x": 1,
511
- "y": .5
512
- }
513
- },
514
- "Stretch": {
515
- "opacity": 1,
516
- "blendMode": "normal",
517
- "center": {
518
- "x": .5,
519
- "y": .5
520
- },
521
- "strength": 1,
522
- "angle": 0,
523
- "falloff": 0,
524
- "edges": "stretch"
525
- },
526
- "Stripes": {
527
- "opacity": 1,
528
- "blendMode": "normal",
529
- "colorA": "#000000",
530
- "colorB": "#ffffff",
531
- "angle": 45,
532
- "density": 5,
533
- "balance": .5,
534
- "softness": 0,
535
- "speed": .2,
536
- "offset": 0,
537
- "colorSpace": "linear"
538
- },
539
- "Swirl": {
540
- "opacity": 1,
541
- "blendMode": "normal",
542
- "colorA": "#1275d8",
543
- "colorB": "#e19136",
544
- "speed": 1,
545
- "detail": 1,
546
- "blend": 50,
547
- "colorSpace": "linear"
548
- },
549
- "TiltShift": {
550
- "opacity": 1,
551
- "blendMode": "normal",
552
- "intensity": 50,
553
- "width": .3,
554
- "falloff": .3,
555
- "angle": 0,
556
- "center": {
557
- "x": .5,
558
- "y": .5
559
- }
560
- },
561
- "Tint": {
562
- "opacity": 1,
563
- "blendMode": "normal",
564
- "color": "#ff8800",
565
- "amount": .5,
566
- "preserveLuminosity": true
567
- },
568
- "Tritone": {
569
- "opacity": 1,
570
- "blendMode": "normal",
571
- "colorA": "#ce1bea",
572
- "colorB": "#2fff00",
573
- "colorC": "#ffff00",
574
- "blendMid": .5,
575
- "colorSpace": "linear"
576
- },
577
- "Twirl": {
578
- "opacity": 1,
579
- "blendMode": "normal",
580
- "center": {
581
- "x": .5,
582
- "y": .5
583
- },
584
- "intensity": 1,
585
- "edges": "stretch"
586
- },
587
- "Vibrance": {
588
- "opacity": 1,
589
- "blendMode": "normal",
590
- "intensity": 0
591
- },
592
- "WaveDistortion": {
593
- "opacity": 1,
594
- "blendMode": "normal",
595
- "strength": .3,
596
- "frequency": 1,
597
- "speed": 1,
598
- "angle": 0,
599
- "waveType": "sine",
600
- "edges": "stretch"
601
- },
602
- "ZoomBlur": {
603
- "opacity": 1,
604
- "blendMode": "normal",
605
- "intensity": 30,
606
- "center": {
607
- "x": .5,
608
- "y": .5
609
- }
610
- }
611
- };
612
- function generatePropString(props, componentType, indent = " ") {
613
- return Object.entries(props).sort(([a], [b]) => a.localeCompare(b)).filter(([key, value]) => {
614
- if (key === "maskType" && value === "alpha") return false;
615
- if (key === "transform" && typeof value === "object") {
616
- if (Object.keys(DEFAULT_TRANSFORM).every((k) => value[k] === DEFAULT_TRANSFORM[k])) return false;
617
- }
618
- const componentDefaults = shaderMetadata[componentType] || {};
619
- if (componentDefaults.hasOwnProperty(key)) {
620
- const defaultValue = componentDefaults[key];
621
- if (value != null && defaultValue != null && typeof value === "object" && typeof defaultValue === "object") return JSON.stringify(value) !== JSON.stringify(defaultValue);
622
- return value !== defaultValue;
623
- }
624
- if (key === "opacity" && value === 1) return false;
625
- if (key === "blendMode" && value === "normal") return false;
626
- return true;
627
- }).map(([key, value]) => {
628
- const kebabKey = camelToKebab(key);
629
- if (key === "transform" && typeof value === "object") {
630
- const nonDefaultKeys = {};
631
- for (const k in value) if (value[k] !== DEFAULT_TRANSFORM[k]) nonDefaultKeys[k] = value[k];
632
- const keys = Object.keys(nonDefaultKeys).sort();
633
- if (keys.length > 1) return `:${kebabKey}="{\n${indent} ${keys.map((k) => `'${k}':${typeof nonDefaultKeys[k] === "string" ? `'${nonDefaultKeys[k]}'` : nonDefaultKeys[k]}`).join(`,\n${indent} `)}\n${indent} }"`;
634
- else if (keys.length === 1) {
635
- const k = keys[0];
636
- const v = nonDefaultKeys[k];
637
- return `:${kebabKey}="{'${k}':${typeof v === "string" ? `'${v}'` : v}}"`;
638
- }
639
- }
640
- if (typeof value === "string") return `${kebabKey}="${value}"`;
641
- else if (value !== null && typeof value === "object") {
642
- const roundedValue = { ...value };
643
- if ("x" in roundedValue && typeof roundedValue.x === "number") roundedValue.x = Math.round(roundedValue.x * 100) / 100;
644
- if ("y" in roundedValue && typeof roundedValue.y === "number") roundedValue.y = Math.round(roundedValue.y * 100) / 100;
645
- return `:${kebabKey}="${JSON.stringify(roundedValue).replace(/"/g, "'")}"`;
646
- } else return `:${kebabKey}="${value}"`;
647
- }).join("\n" + indent + " ");
648
- }
649
- function isIdUsedAsMaskSource(id, allComponents) {
650
- const flatComponents = [];
651
- function flattenComponents(components) {
652
- for (const component of components) {
653
- flatComponents.push(component);
654
- if (component.children) flattenComponents(component.children);
655
- }
656
- }
657
- flattenComponents(allComponents);
658
- return flatComponents.some((component) => component.props?.maskSource === id);
659
- }
660
- function generatePresetCode(preset) {
661
- const generateComponentString = (config, indent = " ") => {
662
- const propString = config.props ? generatePropString(config.props, config.type, indent) : "";
663
- let idString = "";
664
- if (config.id) {
665
- if (isIdUsedAsMaskSource(config.id, preset.components)) idString = `id="${config.id}"`;
666
- }
667
- const attributes = [idString, propString].filter(Boolean).join("\n" + indent + " ");
668
- if (config.children && config.children.length > 0) {
669
- const childrenString = config.children.map((child) => generateComponentString(child, indent + " ")).join("\n");
670
- if (attributes) return `${indent}<${config.type}\n${indent} ${attributes}>\n${childrenString}\n${indent}</${config.type}>`;
671
- else return `${indent}<${config.type}>\n${childrenString}\n${indent}</${config.type}>`;
672
- } else if (attributes) return `${indent}<${config.type}\n${indent} ${attributes}/>`;
673
- else return `${indent}<${config.type}/>`;
674
- };
675
- return `<Shader>\n${preset.components.map((config) => generateComponentString(config)).join("\n")}\n</Shader>`;
676
- }
677
- const availableComponents = [
678
- "AngularBlur",
679
- "Ascii",
680
- "Beam",
681
- "Blob",
682
- "Blur",
683
- "BrightnessContrast",
684
- "Bulge",
685
- "CRTScreen",
686
- "ChannelBlur",
687
- "Checkerboard",
688
- "ChromaFlow",
689
- "ChromaticAberration",
690
- "Circle",
691
- "CursorTrail",
692
- "DiffuseBlur",
693
- "Dither",
694
- "DotGrid",
695
- "Duotone",
696
- "FilmGrain",
697
- "FloatingParticles",
698
- "GlassTiles",
699
- "Glow",
700
- "Godrays",
701
- "Grayscale",
702
- "Grid",
703
- "GridDistortion",
704
- "Group",
705
- "Halftone",
706
- "HueShift",
707
- "ImageTexture",
708
- "Invert",
709
- "LinearBlur",
710
- "LinearGradient",
711
- "Liquify",
712
- "Perspective",
713
- "Pixelate",
714
- "PolarCoordinates",
715
- "Posterize",
716
- "ProgressiveBlur",
717
- "RadialGradient",
718
- "RectangularCoordinates",
719
- "Ripples",
720
- "Saturation",
721
- "Sharpness",
722
- "Shatter",
723
- "SimplexNoise",
724
- "SineWave",
725
- "SolidColor",
726
- "Spherize",
727
- "Spiral",
728
- "Strands",
729
- "Stretch",
730
- "Stripes",
731
- "Swirl",
732
- "TiltShift",
733
- "Tint",
734
- "Tritone",
735
- "Twirl",
736
- "Vibrance",
737
- "WaveDistortion",
738
- "ZoomBlur"
739
- ];
740
- export { generatePresetCode as n, availableComponents as t };