shaders 2.2.44 → 2.2.45

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 (129) hide show
  1. package/dist/core/{AngularBlur-CuwAjUOA.js → AngularBlur-CQYutWxj.js} +6 -2
  2. package/dist/core/{Beam-CbG4MkLo.js → Beam-CZo-XeQ-.js} +4 -4
  3. package/dist/core/{Blob-Ck1tVOL_.js → Blob-D3PIrwWv.js} +7 -7
  4. package/dist/core/{BrightnessContrast-CaErceqR.js → BrightnessContrast-SC7HYw9z.js} +2 -2
  5. package/dist/core/{Bulge-BVcWo6On.js → Bulge-CbZA25NX.js} +3 -3
  6. package/dist/core/{CRTScreen-CcAYeqoI.js → CRTScreen-DV5Y2GRA.js} +34 -6
  7. package/dist/core/{Checkerboard-D_hGvoO7.js → Checkerboard-DBcVaYQv.js} +6 -9
  8. package/dist/core/{ChromaFlow-DizYQSgf.js → ChromaFlow-DcqnZ1wf.js} +5 -4
  9. package/dist/core/{ChromaticAberration-Bk_DMYJm.js → ChromaticAberration-Dgf83J6w.js} +4 -3
  10. package/dist/core/{Circle-BlVzkeyl.js → Circle-BWd84W7f.js} +2 -2
  11. package/dist/core/{CursorTrail-CxXWV7KH.js → CursorTrail-BKfdORYc.js} +5 -4
  12. package/dist/core/{Dither-C1KyBYuE.js → Dither-DWoCLL0e.js} +1 -1
  13. package/dist/core/{DotGrid-ll8XCA0p.js → DotGrid-BZVfqUZO.js} +2 -2
  14. package/dist/core/{Duotone-d2gQJr4M.js → Duotone-sjvdZBlx.js} +1 -1
  15. package/dist/core/{FilmGrain-3h6TIe1T.js → FilmGrain-Cr3qP38A.js} +1 -1
  16. package/dist/core/{FloatingParticles-D95-rj4h.js → FloatingParticles-CPsVFZJl.js} +5 -5
  17. package/dist/core/{GlassTiles-DqT67iqr.js → GlassTiles-C6LLjlnB.js} +9 -7
  18. package/dist/core/{Glow-BYNKuw0E.js → Glow-C2avDr73.js} +3 -3
  19. package/dist/core/{Godrays-DCk1c8sQ.js → Godrays-RVh5ylQ-.js} +8 -6
  20. package/dist/core/{GridDistortion-D-iiGELF.js → GridDistortion-fimECOse.js} +12 -23
  21. package/dist/core/{Halftone-CV0aFuRG.js → Halftone-Cb5yrPnj.js} +1 -1
  22. package/dist/core/{LinearBlur-CTXjolzL.js → LinearBlur-CfMT259a.js} +2 -1
  23. package/dist/core/{LinearGradient-CZo6e7r8.js → LinearGradient-Cn7w-umQ.js} +6 -2
  24. package/dist/core/{Liquify-BbfDBMNZ.js → Liquify-BCkIt0A1.js} +1 -18
  25. package/dist/core/{Perspective-CSP2Hb16.js → Perspective-CJOFHxEC.js} +1 -1
  26. package/dist/core/{Pixelate-BAoi-CSx.js → Pixelate-BhNAxBsT.js} +7 -3
  27. package/dist/core/{PolarCoordinates-BwN9HhFK.js → PolarCoordinates-DLs3K__1.js} +3 -3
  28. package/dist/core/{ProgressiveBlur-RuAm_BKx.js → ProgressiveBlur-BIZSnUjp.js} +5 -2
  29. package/dist/core/{RadialGradient-BfFuRbIl.js → RadialGradient-sQgXXXQk.js} +1 -1
  30. package/dist/core/{RectangularCoordinates-CiW3J4UT.js → RectangularCoordinates-CyarkXn0.js} +2 -2
  31. package/dist/core/{Ripples-DKBIp3Qq.js → Ripples-Djjw66Bn.js} +3 -3
  32. package/dist/core/{Saturation-DVVlpikK.js → Saturation-DLHW_GP6.js} +1 -1
  33. package/dist/core/{Sharpness-cw57bW0s.js → Sharpness-DkGuV_dy.js} +1 -1
  34. package/dist/core/{Shatter-COjV2jLy.js → Shatter-DVgj2Ea3.js} +3 -2
  35. package/dist/core/{SimplexNoise-Ce79jgYM.js → SimplexNoise-BXtLTcAr.js} +1 -1
  36. package/dist/core/{SineWave-Cv2gOU8a.js → SineWave-BxqFasFh.js} +3 -3
  37. package/dist/core/{Spherize-R-s4pX9t.js → Spherize-DIJ4c_EG.js} +4 -4
  38. package/dist/core/{Spiral-W4dALX1z.js → Spiral-BBtmU1Fv.js} +3 -3
  39. package/dist/core/{Strands-DtN5POfO.js → Strands-D6UOhX0L.js} +5 -5
  40. package/dist/core/{Stretch-BzvP_hdu.js → Stretch-DLpz8Ofm.js} +2 -2
  41. package/dist/core/{Stripes-BbNFX05u.js → Stripes-Bre3Z2m_.js} +5 -5
  42. package/dist/core/{TiltShift-B6gbm7Z8.js → TiltShift-BPpXBzBg.js} +6 -4
  43. package/dist/core/{Tint-CpnitsHw.js → Tint-BazvezVn.js} +1 -1
  44. package/dist/core/{Tritone-DzvSKVfR.js → Tritone-w0h2ebDB.js} +1 -1
  45. package/dist/core/{Twirl-BXH4uAd6.js → Twirl-dmfYS2Eo.js} +7 -5
  46. package/dist/core/{Vibrance-ByN9bRgU.js → Vibrance-BpWyAK9W.js} +1 -1
  47. package/dist/core/{WaveDistortion-BA1PyqYH.js → WaveDistortion-hWdvaZmT.js} +6 -4
  48. package/dist/core/{ZoomBlur-CIkkDBIo.js → ZoomBlur-DCI4uHOL.js} +5 -2
  49. package/dist/core/registry.js +48 -48
  50. package/dist/core/shaders/AngularBlur/index.d.ts.map +1 -1
  51. package/dist/core/shaders/AngularBlur/index.js +1 -1
  52. package/dist/core/shaders/Beam/index.js +1 -1
  53. package/dist/core/shaders/Blob/index.js +1 -1
  54. package/dist/core/shaders/BrightnessContrast/index.js +1 -1
  55. package/dist/core/shaders/Bulge/index.js +1 -1
  56. package/dist/core/shaders/CRTScreen/index.d.ts +14 -0
  57. package/dist/core/shaders/CRTScreen/index.d.ts.map +1 -1
  58. package/dist/core/shaders/CRTScreen/index.js +1 -1
  59. package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
  60. package/dist/core/shaders/Checkerboard/index.js +1 -1
  61. package/dist/core/shaders/ChromaFlow/index.d.ts +1 -1
  62. package/dist/core/shaders/ChromaFlow/index.d.ts.map +1 -1
  63. package/dist/core/shaders/ChromaFlow/index.js +1 -1
  64. package/dist/core/shaders/ChromaticAberration/index.d.ts.map +1 -1
  65. package/dist/core/shaders/ChromaticAberration/index.js +1 -1
  66. package/dist/core/shaders/Circle/index.js +1 -1
  67. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  68. package/dist/core/shaders/CursorTrail/index.js +1 -1
  69. package/dist/core/shaders/Dither/index.js +1 -1
  70. package/dist/core/shaders/DotGrid/index.js +1 -1
  71. package/dist/core/shaders/Duotone/index.js +1 -1
  72. package/dist/core/shaders/FilmGrain/index.js +1 -1
  73. package/dist/core/shaders/FloatingParticles/index.js +1 -1
  74. package/dist/core/shaders/GlassTiles/index.d.ts +1 -1
  75. package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
  76. package/dist/core/shaders/GlassTiles/index.js +1 -1
  77. package/dist/core/shaders/Glow/index.js +1 -1
  78. package/dist/core/shaders/Godrays/index.d.ts.map +1 -1
  79. package/dist/core/shaders/Godrays/index.js +1 -1
  80. package/dist/core/shaders/GridDistortion/index.d.ts +0 -7
  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/Halftone/index.js +1 -1
  84. package/dist/core/shaders/LinearBlur/index.d.ts.map +1 -1
  85. package/dist/core/shaders/LinearBlur/index.js +1 -1
  86. package/dist/core/shaders/LinearGradient/index.d.ts.map +1 -1
  87. package/dist/core/shaders/LinearGradient/index.js +1 -1
  88. package/dist/core/shaders/Liquify/index.d.ts +0 -7
  89. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  90. package/dist/core/shaders/Liquify/index.js +1 -1
  91. package/dist/core/shaders/Perspective/index.js +1 -1
  92. package/dist/core/shaders/Pixelate/index.d.ts +1 -1
  93. package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
  94. package/dist/core/shaders/Pixelate/index.js +1 -1
  95. package/dist/core/shaders/PolarCoordinates/index.js +1 -1
  96. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  97. package/dist/core/shaders/ProgressiveBlur/index.js +1 -1
  98. package/dist/core/shaders/RadialGradient/index.js +1 -1
  99. package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
  100. package/dist/core/shaders/Ripples/index.js +1 -1
  101. package/dist/core/shaders/Saturation/index.js +1 -1
  102. package/dist/core/shaders/Sharpness/index.js +1 -1
  103. package/dist/core/shaders/Shatter/index.d.ts.map +1 -1
  104. package/dist/core/shaders/Shatter/index.js +1 -1
  105. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  106. package/dist/core/shaders/SineWave/index.js +1 -1
  107. package/dist/core/shaders/Spherize/index.js +1 -1
  108. package/dist/core/shaders/Spiral/index.js +1 -1
  109. package/dist/core/shaders/Strands/index.d.ts +1 -1
  110. package/dist/core/shaders/Strands/index.js +1 -1
  111. package/dist/core/shaders/Stretch/index.js +1 -1
  112. package/dist/core/shaders/Stripes/index.d.ts +1 -1
  113. package/dist/core/shaders/Stripes/index.js +1 -1
  114. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  115. package/dist/core/shaders/TiltShift/index.js +1 -1
  116. package/dist/core/shaders/Tint/index.js +1 -1
  117. package/dist/core/shaders/Tritone/index.js +1 -1
  118. package/dist/core/shaders/Twirl/index.d.ts.map +1 -1
  119. package/dist/core/shaders/Twirl/index.js +1 -1
  120. package/dist/core/shaders/Vibrance/index.js +1 -1
  121. package/dist/core/shaders/WaveDistortion/index.d.ts.map +1 -1
  122. package/dist/core/shaders/WaveDistortion/index.js +1 -1
  123. package/dist/core/shaders/ZoomBlur/index.d.ts.map +1 -1
  124. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  125. package/dist/registry.js +228 -228
  126. package/dist/vue/CRTScreen.vue_vue_type_script_setup_true_lang.js +3 -1
  127. package/dist/vue/GridDistortion.vue_vue_type_script_setup_true_lang.js +0 -1
  128. package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +0 -1
  129. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
2
2
  import { o as transformEdges } from "./transformations-YbhRK-rd.js";
3
3
  import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
4
- import { convertToTexture, float, screenUV, texture, uniform, vec2, vec4 } from "three/tsl";
4
+ import { convertToTexture, float, screenUV, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
5
5
  var DEFAULT_GRID_SIZE = 20;
6
6
  var displacementStateCache = /* @__PURE__ */ new WeakMap();
7
7
  var getOrCreateDisplacementState = (uniforms) => {
@@ -46,17 +46,6 @@ const componentDefinition = {
46
46
  label: "Intensity"
47
47
  }
48
48
  },
49
- swirl: {
50
- default: 0,
51
- description: "Amount of swirl motion",
52
- ui: {
53
- type: "range",
54
- min: 0,
55
- max: 2,
56
- step: .1,
57
- label: "Swirl"
58
- }
59
- },
60
49
  decay: {
61
50
  default: 3,
62
51
  description: "Rate of distortion decay (higher = faster)",
@@ -75,7 +64,7 @@ const componentDefinition = {
75
64
  type: "range",
76
65
  min: 0,
77
66
  max: 3,
78
- step: .01,
67
+ step: .1,
79
68
  label: "Radius"
80
69
  }
81
70
  },
@@ -118,7 +107,7 @@ const componentDefinition = {
118
107
  }
119
108
  }
120
109
  },
121
- fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup }) => {
110
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions }) => {
122
111
  const { dataTexture: displacementTexture, data: displacementData, tslNode: displacementField, gridSize: GRID_SIZE } = getOrCreateDisplacementState(uniforms);
123
112
  const mouseVelX = uniform(0);
124
113
  const mouseVelY = uniform(0);
@@ -129,6 +118,7 @@ const componentDefinition = {
129
118
  const currentTime = Date.now();
130
119
  const dt = Math.min((currentTime - lastTime) / 1e3, .016);
131
120
  lastTime = currentTime;
121
+ const aspect$1 = Math.max(1, dimensions.width) / Math.max(1, dimensions.height);
132
122
  const velX = dt > 0 ? (pointer.x - prevX) / dt : 0;
133
123
  const velY = dt > 0 ? (pointer.y - prevY) / dt : 0;
134
124
  mouseVelX.value = mouseVelX.value * .85 + velX * .15;
@@ -136,25 +126,19 @@ const componentDefinition = {
136
126
  const decay = uniforms.decay.uniform.value;
137
127
  const intensity = uniforms.intensity.uniform.value;
138
128
  const radius = uniforms.radius.uniform.value * .05;
139
- const swirl = uniforms.swirl.uniform.value;
140
129
  for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
141
130
  const idx = (i * GRID_SIZE + j) * 2;
142
131
  displacementData[idx] *= 1 - decay * dt;
143
132
  displacementData[idx + 1] *= 1 - decay * dt;
144
133
  const cellX = (j + .5) / GRID_SIZE;
145
134
  const cellY = (i + .5) / GRID_SIZE;
146
- const dx = cellX - pointer.x;
135
+ const dx = (cellX - pointer.x) / aspect$1;
147
136
  const dy = cellY - pointer.y;
148
137
  const dist = Math.sqrt(dx * dx + dy * dy);
149
138
  if (dist < radius * 2 && Math.abs(velX) + Math.abs(velY) > .01) {
150
139
  const influence = Math.exp(-dist * dist / (radius * radius));
151
140
  displacementData[idx] += mouseVelX.value * influence * intensity * dt * .5;
152
141
  displacementData[idx + 1] += mouseVelY.value * influence * intensity * dt * .5;
153
- if (swirl > 0) {
154
- const angle = Math.atan2(dy, dx) + Math.PI * .5;
155
- displacementData[idx] += Math.cos(angle) * swirl * influence * dt * 2;
156
- displacementData[idx + 1] += Math.sin(angle) * swirl * influence * dt * 2;
157
- }
158
142
  }
159
143
  displacementData[idx] = Math.max(-1, Math.min(1, displacementData[idx]));
160
144
  displacementData[idx + 1] = Math.max(-1, Math.min(1, displacementData[idx + 1]));
@@ -172,9 +156,14 @@ const componentDefinition = {
172
156
  onCleanup(() => {
173
157
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
174
158
  });
159
+ const aspect = viewportSize.x.div(viewportSize.y);
175
160
  const gridSizeUniform = uniforms.gridSize.uniform;
176
- const gridScale = float(1).div(gridSizeUniform);
177
- const gridCellUV = screenUV.div(gridScale).floor().mul(gridScale).add(gridScale.mul(.5));
161
+ const isWide = aspect.greaterThan(float(1));
162
+ const cellsX = isWide.select(gridSizeUniform, gridSizeUniform.mul(aspect)).max(float(1));
163
+ const cellsY = isWide.select(gridSizeUniform.div(aspect), gridSizeUniform).max(float(1));
164
+ const cellIndexX = screenUV.x.mul(cellsX).floor();
165
+ const cellIndexY = screenUV.y.mul(cellsY).floor();
166
+ const gridCellUV = vec2(cellIndexX.add(.5).div(cellsX), cellIndexY.add(.5).div(cellsY));
178
167
  const displacement = displacementField.sample(gridCellUV).xy;
179
168
  const maxDisplacement = float(.1);
180
169
  const negMaxDisplacement = float(-.1);
@@ -36,7 +36,7 @@ const componentDefinition = {
36
36
  type: "range",
37
37
  min: 0,
38
38
  max: .3,
39
- step: .01,
39
+ step: .1,
40
40
  label: "Smoothness"
41
41
  }
42
42
  }
@@ -38,7 +38,8 @@ const componentDefinition = {
38
38
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
39
39
  });
40
40
  const angleRad = radians(uniforms.angle.uniform);
41
- const blurDirection = vec2(cos(angleRad), sin(angleRad));
41
+ const aspect = viewportSize.x.div(viewportSize.y);
42
+ const blurDirection = vec2(cos(angleRad).div(aspect), sin(angleRad));
42
43
  return Fn(() => {
43
44
  const uv$1 = screenUV;
44
45
  const texel = vec2(1).div(viewportSize);
@@ -1,6 +1,6 @@
1
1
  import { i as transformColorSpace, n as transformAngle, o as transformEdges, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
2
2
  import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
3
- import { abs, cos, dot, float, fract, length, mod, normalize, radians, screenUV, sin, vec2, vec4 } from "three/tsl";
3
+ import { abs, cos, dot, float, fract, length, mod, normalize, radians, screenUV, sin, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
5
5
  name: "LinearGradient",
6
6
  category: "Base Layers",
@@ -105,12 +105,16 @@ const componentDefinition = {
105
105
  const gradientVector = endPos.sub(startPos);
106
106
  const gradientLength = length(gradientVector);
107
107
  const gradientDir = normalize(gradientVector);
108
+ const safeViewportY = viewportSize.y.max(1e-6);
109
+ const aspect = viewportSize.x.div(safeViewportY);
108
110
  const angleRad = radians(uniforms.angle.uniform).negate();
109
111
  const cosAngle = cos(angleRad);
110
112
  const sinAngle = sin(angleRad);
111
113
  const midpoint = startPos.add(endPos).mul(.5);
112
114
  const centeredUV = uv$1.sub(midpoint);
113
- const t = dot(vec2(centeredUV.x.mul(cosAngle).sub(centeredUV.y.mul(sinAngle)), centeredUV.x.mul(sinAngle).add(centeredUV.y.mul(cosAngle))).add(midpoint).sub(startPos), gradientDir).div(gradientLength.max(1e-6));
115
+ const aspectCorrectedCentered = vec2(centeredUV.x.mul(aspect), centeredUV.y);
116
+ const rotatedCorrected = vec2(aspectCorrectedCentered.x.mul(cosAngle).sub(aspectCorrectedCentered.y.mul(sinAngle)), aspectCorrectedCentered.x.mul(sinAngle).add(aspectCorrectedCentered.y.mul(cosAngle)));
117
+ const t = dot(vec2(rotatedCorrected.x.div(aspect), rotatedCorrected.y).add(midpoint).sub(startPos), gradientDir).div(gradientLength.max(1e-6));
114
118
  const edgeMode = uniforms.edges.uniform;
115
119
  const stretchT = t.clamp(float(0), float(1));
116
120
  const inBoundsX = t.greaterThanEqual(float(0)).select(float(1), float(0));
@@ -40,17 +40,6 @@ const componentDefinition = {
40
40
  label: "Intensity"
41
41
  }
42
42
  },
43
- swirl: {
44
- default: 0,
45
- description: "Amount of swirl motion (0-1)",
46
- ui: {
47
- type: "range",
48
- min: 0,
49
- max: 1,
50
- step: .01,
51
- label: "Swirl"
52
- }
53
- },
54
43
  decay: {
55
44
  default: 3,
56
45
  description: "Rate of distortion decay (higher = faster)",
@@ -69,7 +58,7 @@ const componentDefinition = {
69
58
  type: "range",
70
59
  min: 0,
71
60
  max: 3,
72
- step: .01,
61
+ step: .1,
73
62
  label: "Radius"
74
63
  }
75
64
  },
@@ -119,7 +108,6 @@ const componentDefinition = {
119
108
  const decay = uniforms.decay.uniform.value;
120
109
  const intensity = uniforms.intensity.uniform.value;
121
110
  const radius = uniforms.radius.uniform.value * .05;
122
- const swirl = uniforms.swirl.uniform.value;
123
111
  for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
124
112
  const idx = (i * GRID_SIZE + j) * 2;
125
113
  displacementData[idx] *= 1 - decay * dt;
@@ -133,11 +121,6 @@ const componentDefinition = {
133
121
  const influence = Math.exp(-dist * dist / (radius * radius));
134
122
  displacementData[idx] += mouseVelX.value * influence * intensity * dt * .5;
135
123
  displacementData[idx + 1] += mouseVelY.value * influence * intensity * dt * .5;
136
- if (swirl > 0) {
137
- const angle = Math.atan2(dy, dx) + Math.PI * .5;
138
- displacementData[idx] += Math.cos(angle) * swirl * influence * dt * 2;
139
- displacementData[idx + 1] += Math.sin(angle) * swirl * influence * dt * 2;
140
- }
141
124
  }
142
125
  displacementData[idx] = Math.max(-1, Math.min(1, displacementData[idx]));
143
126
  displacementData[idx + 1] = Math.max(-1, Math.min(1, displacementData[idx + 1]));
@@ -60,7 +60,7 @@ const componentDefinition = {
60
60
  type: "range",
61
61
  min: .5,
62
62
  max: 3,
63
- step: .01,
63
+ step: .1,
64
64
  label: "Zoom"
65
65
  }
66
66
  },
@@ -1,4 +1,4 @@
1
- import { convertToTexture, floor, screenUV, vec4 } from "three/tsl";
1
+ import { convertToTexture, float, floor, screenUV, vec2, vec4, viewportSize } from "three/tsl";
2
2
  const componentDefinition = {
3
3
  name: "Pixelate",
4
4
  category: "Stylize",
@@ -7,7 +7,7 @@ const componentDefinition = {
7
7
  requiresChild: true,
8
8
  props: { scale: {
9
9
  default: 50,
10
- description: "Pixel size - higher values create larger, more visible pixels",
10
+ description: "Number of pixels along the longest edge (higher = smaller pixels)",
11
11
  ui: {
12
12
  type: "range",
13
13
  min: 1,
@@ -22,8 +22,12 @@ const componentDefinition = {
22
22
  onCleanup(() => {
23
23
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
24
24
  });
25
+ const aspect = viewportSize.x.div(viewportSize.y);
25
26
  const pixelSize = uniforms.scale.uniform;
26
- const pixelatedUV = floor(screenUV.mul(pixelSize)).div(pixelSize);
27
+ const isWide = aspect.greaterThan(float(1));
28
+ const pixelCountX = isWide.select(pixelSize, pixelSize.mul(aspect)).max(float(1));
29
+ const pixelCountY = isWide.select(pixelSize.div(aspect), pixelSize).max(float(1));
30
+ const pixelatedUV = vec2(floor(screenUV.x.mul(pixelCountX)).div(pixelCountX), floor(screenUV.y.mul(pixelCountY)).div(pixelCountY));
27
31
  return childTexture.sample(pixelatedUV);
28
32
  }
29
33
  };
@@ -27,7 +27,7 @@ const componentDefinition = {
27
27
  type: "range",
28
28
  min: 0,
29
29
  max: 2,
30
- step: .01,
30
+ step: .1,
31
31
  label: "Wrap"
32
32
  }
33
33
  },
@@ -38,7 +38,7 @@ const componentDefinition = {
38
38
  type: "range",
39
39
  min: 0,
40
40
  max: 2,
41
- step: .01,
41
+ step: .1,
42
42
  label: "Radius"
43
43
  }
44
44
  },
@@ -49,7 +49,7 @@ const componentDefinition = {
49
49
  type: "range",
50
50
  min: 0,
51
51
  max: 1,
52
- step: .01,
52
+ step: .1,
53
53
  label: "Intensity"
54
54
  }
55
55
  },
@@ -49,7 +49,7 @@ const componentDefinition = {
49
49
  type: "range",
50
50
  min: 0,
51
51
  max: 1,
52
- step: .01,
52
+ step: .1,
53
53
  label: "Falloff"
54
54
  }
55
55
  }
@@ -60,8 +60,11 @@ const componentDefinition = {
60
60
  onCleanup(() => {
61
61
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
62
62
  });
63
+ const aspect = viewportSize.x.div(viewportSize.y);
63
64
  const angleRad = radians(uniforms.angle.uniform);
64
- const direction = vec2(cos(angleRad), sin(angleRad));
65
+ const cosAngle = cos(angleRad);
66
+ const sinAngle = sin(angleRad);
67
+ const direction = vec2(cosAngle.div(aspect), sinAngle);
65
68
  const centerPosition = vec2(uniforms.center.uniform[0], uniforms.center.uniform[1].oneMinus());
66
69
  const centeredUV = screenUV.sub(centerPosition);
67
70
  const directionalDist = max(float(0), centeredUV.dot(direction));
@@ -43,7 +43,7 @@ const componentDefinition = {
43
43
  type: "range",
44
44
  min: 0,
45
45
  max: 2,
46
- step: .01,
46
+ step: .1,
47
47
  label: "Radius"
48
48
  }
49
49
  },
@@ -27,7 +27,7 @@ const componentDefinition = {
27
27
  type: "range",
28
28
  min: .1,
29
29
  max: 3,
30
- step: .01,
30
+ step: .1,
31
31
  label: "Scale"
32
32
  }
33
33
  },
@@ -38,7 +38,7 @@ const componentDefinition = {
38
38
  type: "range",
39
39
  min: 0,
40
40
  max: 1,
41
- step: .01,
41
+ step: .1,
42
42
  label: "Intensity"
43
43
  }
44
44
  },
@@ -66,7 +66,7 @@ const componentDefinition = {
66
66
  type: "range",
67
67
  min: 0,
68
68
  max: 3,
69
- step: .01,
69
+ step: .1,
70
70
  label: "Softness"
71
71
  }
72
72
  },
@@ -77,7 +77,7 @@ const componentDefinition = {
77
77
  type: "range",
78
78
  min: 0,
79
79
  max: 1,
80
- step: .01,
80
+ step: .1,
81
81
  label: "Thickness"
82
82
  }
83
83
  },
@@ -88,7 +88,7 @@ const componentDefinition = {
88
88
  type: "range",
89
89
  min: 0,
90
90
  max: 6.28,
91
- step: .01,
91
+ step: .1,
92
92
  label: "Phase"
93
93
  }
94
94
  }
@@ -11,7 +11,7 @@ const componentDefinition = {
11
11
  type: "range",
12
12
  min: 0,
13
13
  max: 3,
14
- step: .01,
14
+ step: .1,
15
15
  label: "Intensity"
16
16
  }
17
17
  } },
@@ -12,7 +12,7 @@ const componentDefinition = {
12
12
  type: "range",
13
13
  min: 0,
14
14
  max: 5,
15
- step: .01,
15
+ step: .1,
16
16
  label: "Sharpness"
17
17
  }
18
18
  } },
@@ -129,7 +129,7 @@ const componentDefinition = {
129
129
  }
130
130
  }
131
131
  },
132
- fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup }) => {
132
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions }) => {
133
133
  const SHARD_COUNT = 16;
134
134
  const FRICTION = 1;
135
135
  const cellData = new Float32Array(SHARD_COUNT * 4);
@@ -160,6 +160,7 @@ const componentDefinition = {
160
160
  const currentTime = Date.now();
161
161
  const dt = Math.min((currentTime - lastTime) / 1e3, .016);
162
162
  lastTime = currentTime;
163
+ const aspect = dimensions.width / dimensions.height;
163
164
  const newSeed = uniforms.seed.uniform.value;
164
165
  if (newSeed !== currentSeed) {
165
166
  currentSeed = newSeed;
@@ -185,7 +186,7 @@ const componentDefinition = {
185
186
  const cellY = cellData[i * 4 + 1];
186
187
  const randomDirX = cellData[i * 4 + 2] - .5;
187
188
  const randomDirY = cellData[i * 4 + 3] - .5;
188
- const dx = cellX - pointer.x;
189
+ const dx = (cellX - pointer.x) / aspect;
189
190
  const dy = cellY - pointer.y;
190
191
  const dist = Math.sqrt(dx * dx + dy * dy);
191
192
  let currentDx = displacementData[i * 4];
@@ -43,7 +43,7 @@ const componentDefinition = {
43
43
  type: "range",
44
44
  min: -1,
45
45
  max: 1,
46
- step: .01,
46
+ step: .1,
47
47
  label: "Balance"
48
48
  }
49
49
  },
@@ -22,7 +22,7 @@ const componentDefinition = {
22
22
  type: "range",
23
23
  min: 0,
24
24
  max: 1,
25
- step: .01,
25
+ step: .1,
26
26
  label: "Amplitude"
27
27
  }
28
28
  },
@@ -79,7 +79,7 @@ const componentDefinition = {
79
79
  type: "range",
80
80
  min: 0,
81
81
  max: 2,
82
- step: .01,
82
+ step: .1,
83
83
  label: "Thickness"
84
84
  }
85
85
  },
@@ -90,7 +90,7 @@ const componentDefinition = {
90
90
  type: "range",
91
91
  min: 0,
92
92
  max: 1,
93
- step: .01,
93
+ step: .1,
94
94
  label: "Softness"
95
95
  }
96
96
  }
@@ -14,7 +14,7 @@ const componentDefinition = {
14
14
  type: "range",
15
15
  min: .1,
16
16
  max: 3,
17
- step: .01,
17
+ step: .1,
18
18
  label: "Radius"
19
19
  }
20
20
  },
@@ -25,7 +25,7 @@ const componentDefinition = {
25
25
  type: "range",
26
26
  min: 0,
27
27
  max: 3,
28
- step: .01,
28
+ step: .1,
29
29
  label: "Depth"
30
30
  }
31
31
  },
@@ -60,7 +60,7 @@ const componentDefinition = {
60
60
  type: "range",
61
61
  min: 0,
62
62
  max: 1,
63
- step: .01,
63
+ step: .1,
64
64
  label: "Light Intensity"
65
65
  }
66
66
  },
@@ -71,7 +71,7 @@ const componentDefinition = {
71
71
  type: "range",
72
72
  min: 0,
73
73
  max: 1,
74
- step: .01,
74
+ step: .1,
75
75
  label: "Light Softness"
76
76
  }
77
77
  },
@@ -32,7 +32,7 @@ const componentDefinition = {
32
32
  type: "range",
33
33
  min: 0,
34
34
  max: 2,
35
- step: .01,
35
+ step: .1,
36
36
  label: "Stroke Width"
37
37
  }
38
38
  },
@@ -43,7 +43,7 @@ const componentDefinition = {
43
43
  type: "range",
44
44
  min: 0,
45
45
  max: 1,
46
- step: .01,
46
+ step: .1,
47
47
  label: "Stroke Falloff"
48
48
  }
49
49
  },
@@ -54,7 +54,7 @@ const componentDefinition = {
54
54
  type: "range",
55
55
  min: 0,
56
56
  max: 1,
57
- step: .01,
57
+ step: .1,
58
58
  label: "Softness"
59
59
  }
60
60
  },
@@ -15,7 +15,7 @@ const componentDefinition = {
15
15
  type: "range",
16
16
  min: 0,
17
17
  max: 1,
18
- step: .01,
18
+ step: .1,
19
19
  label: "Speed"
20
20
  }
21
21
  },
@@ -37,7 +37,7 @@ const componentDefinition = {
37
37
  type: "range",
38
38
  min: 0,
39
39
  max: 5,
40
- step: .01,
40
+ step: .1,
41
41
  label: "Frequency"
42
42
  }
43
43
  },
@@ -57,9 +57,9 @@ const componentDefinition = {
57
57
  description: "Width of wave lines",
58
58
  ui: {
59
59
  type: "range",
60
- min: .01,
61
- max: .5,
62
- step: .01,
60
+ min: 0,
61
+ max: 1,
62
+ step: .05,
63
63
  label: "Line Width"
64
64
  }
65
65
  },
@@ -27,7 +27,7 @@ const componentDefinition = {
27
27
  type: "range",
28
28
  min: 0,
29
29
  max: 1,
30
- step: .01,
30
+ step: .1,
31
31
  label: "Strength"
32
32
  }
33
33
  },
@@ -49,7 +49,7 @@ const componentDefinition = {
49
49
  type: "range",
50
50
  min: 0,
51
51
  max: 1,
52
- step: .01,
52
+ step: .1,
53
53
  label: "Falloff"
54
54
  }
55
55
  },
@@ -53,9 +53,9 @@ const componentDefinition = {
53
53
  description: "Ratio of the two colors",
54
54
  ui: {
55
55
  type: "range",
56
- min: .01,
57
- max: .99,
58
- step: .01,
56
+ min: 0,
57
+ max: 1,
58
+ step: .1,
59
59
  label: "Balance"
60
60
  }
61
61
  },
@@ -66,7 +66,7 @@ const componentDefinition = {
66
66
  type: "range",
67
67
  min: 0,
68
68
  max: 1,
69
- step: .01,
69
+ step: .1,
70
70
  label: "Softness"
71
71
  }
72
72
  },
@@ -88,7 +88,7 @@ const componentDefinition = {
88
88
  type: "range",
89
89
  min: 0,
90
90
  max: 1,
91
- step: .01,
91
+ step: .1,
92
92
  label: "Offset"
93
93
  }
94
94
  },
@@ -25,7 +25,7 @@ const componentDefinition = {
25
25
  type: "range",
26
26
  min: 0,
27
27
  max: 1,
28
- step: .01,
28
+ step: .1,
29
29
  label: "Width"
30
30
  }
31
31
  },
@@ -36,7 +36,7 @@ const componentDefinition = {
36
36
  type: "range",
37
37
  min: 0,
38
38
  max: 1,
39
- step: .01,
39
+ step: .1,
40
40
  label: "Falloff"
41
41
  }
42
42
  },
@@ -71,11 +71,13 @@ const componentDefinition = {
71
71
  onCleanup(() => {
72
72
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
73
73
  });
74
+ const aspect = viewportSize.x.div(viewportSize.y);
74
75
  const angleRad = radians(uniforms.angle.uniform);
75
76
  const cosAngle = cos(angleRad);
76
77
  const perpVector = vec2(sin(angleRad).negate(), cosAngle);
77
78
  const centerPosition = vec2(uniforms.center.uniform[0], uniforms.center.uniform[1].oneMinus());
78
- const distFromLine = abs(dot(screenUV.sub(centerPosition), perpVector));
79
+ const centeredUV = screenUV.sub(centerPosition);
80
+ const distFromLine = abs(dot(vec2(centeredUV.x.mul(aspect), centeredUV.y), perpVector));
79
81
  const focusWidth = uniforms.width.uniform.mul(.5);
80
82
  const falloff = uniforms.falloff.uniform;
81
83
  const blurAmount = smoothstep(focusWidth, focusWidth.add(falloff), distFromLine);
@@ -96,7 +98,7 @@ const componentDefinition = {
96
98
  .135,
97
99
  .056
98
100
  ];
99
- const weightSum = 6.214;
101
+ const weightSum = 6.21;
100
102
  const horizontalTexture = convertToTexture(Fn(() => {
101
103
  const uv$1 = screenUV;
102
104
  const pixelSize = vec2(1).div(viewportSize);
@@ -22,7 +22,7 @@ const componentDefinition = {
22
22
  type: "range",
23
23
  min: 0,
24
24
  max: 1,
25
- step: .01,
25
+ step: .1,
26
26
  label: "Amount"
27
27
  }
28
28
  },
@@ -42,7 +42,7 @@ const componentDefinition = {
42
42
  type: "range",
43
43
  min: 0,
44
44
  max: 1,
45
- step: .01,
45
+ step: .1,
46
46
  label: "Midpoint"
47
47
  }
48
48
  },
@@ -1,6 +1,6 @@
1
1
  import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
2
2
  import { o as transformEdges, s as transformPosition } from "./transformations-YbhRK-rd.js";
3
- import { convertToTexture, cos, length, screenUV, sin, vec2, vec4 } from "three/tsl";
3
+ import { convertToTexture, cos, length, screenUV, sin, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
5
5
  name: "Twirl",
6
6
  category: "Distortions",
@@ -69,14 +69,16 @@ const componentDefinition = {
69
69
  if (texture$1?.renderTarget?.dispose) texture$1.renderTarget.dispose();
70
70
  });
71
71
  const uvNode = screenUV;
72
+ const aspect = viewportSize.x.div(viewportSize.y);
72
73
  const centerPos = vec2(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
73
74
  const delta = uvNode.sub(centerPos);
74
- const angle = uniforms.intensity.uniform.mul(length(delta));
75
+ const aspectCorrectedDelta = vec2(delta.x.mul(aspect), delta.y);
76
+ const angle = uniforms.intensity.uniform.mul(length(aspectCorrectedDelta));
75
77
  const cosAngle = cos(angle);
76
78
  const sinAngle = sin(angle);
77
- const rotatedX = cosAngle.mul(delta.x).sub(sinAngle.mul(delta.y));
78
- const rotatedY = sinAngle.mul(delta.x).add(cosAngle.mul(delta.y));
79
- const twistedUV = vec2(rotatedX.add(centerPos.x), rotatedY.add(centerPos.y));
79
+ const rotatedX = cosAngle.mul(aspectCorrectedDelta.x).sub(sinAngle.mul(aspectCorrectedDelta.y));
80
+ const rotatedY = sinAngle.mul(aspectCorrectedDelta.x).add(cosAngle.mul(aspectCorrectedDelta.y));
81
+ const twistedUV = vec2(rotatedX.div(aspect).add(centerPos.x), rotatedY.add(centerPos.y));
80
82
  return applyEdgeHandling(twistedUV, texture$1.sample(twistedUV), texture$1, uniforms.edges.uniform);
81
83
  }
82
84
  };
@@ -11,7 +11,7 @@ const componentDefinition = {
11
11
  type: "range",
12
12
  min: -2,
13
13
  max: 2,
14
- step: .01,
14
+ step: .1,
15
15
  label: "Intensity"
16
16
  }
17
17
  } },