shaders 2.5.90 → 2.5.91

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.
@@ -107,22 +107,30 @@ const componentDefinition = {
107
107
  }
108
108
  if (speed > .001) {
109
109
  const influenceRadius = radius * 3;
110
- const minJ = Math.max(0, Math.floor((pointer.x - influenceRadius) * GRID_SIZE));
111
- const maxJ = Math.min(GRID_SIZE - 1, Math.ceil((pointer.x + influenceRadius) * GRID_SIZE));
112
- const minI = Math.max(0, Math.floor((pointer.y - influenceRadius) * GRID_SIZE));
113
- const maxI = Math.min(GRID_SIZE - 1, Math.ceil((pointer.y + influenceRadius) * GRID_SIZE));
114
- for (let i = minI; i <= maxI; i++) for (let j = minJ; j <= maxJ; j++) {
115
- const idx = (i * GRID_SIZE + j) * 4;
116
- const cellX = (j + .5) / GRID_SIZE;
117
- const cellY = (i + .5) / GRID_SIZE;
118
- const cellDx = aspect >= 1 ? (cellX - pointer.x) * aspect : cellX - pointer.x;
119
- const cellDy = aspect >= 1 ? cellY - pointer.y : (cellY - pointer.y) / aspect;
120
- const dist = Math.sqrt(cellDx * cellDx + cellDy * cellDy);
121
- if (dist < influenceRadius) {
122
- const addAmount = Math.exp(-dist * dist / (radius * radius)) * speed * 50 * dt;
123
- trailData[idx] = Math.min(1, trailData[idx] + addAmount);
124
- trailData[idx + 1] = 1;
125
- trailData[idx + 2] = 0;
110
+ const stepSize = Math.max(.005, radius * .5);
111
+ const numSteps = Math.min(20, Math.max(1, Math.ceil(speed / stepSize)));
112
+ const amountPerStep = speed / numSteps * 50 * dt;
113
+ for (let s = 0; s < numSteps; s++) {
114
+ const t = (s + .5) / numSteps;
115
+ const px = prevX + dx * t;
116
+ const py = prevY + dy * t;
117
+ const minJ = Math.max(0, Math.floor((px - influenceRadius) * GRID_SIZE));
118
+ const maxJ = Math.min(GRID_SIZE - 1, Math.ceil((px + influenceRadius) * GRID_SIZE));
119
+ const minI = Math.max(0, Math.floor((py - influenceRadius) * GRID_SIZE));
120
+ const maxI = Math.min(GRID_SIZE - 1, Math.ceil((py + influenceRadius) * GRID_SIZE));
121
+ for (let i = minI; i <= maxI; i++) for (let j = minJ; j <= maxJ; j++) {
122
+ const idx = (i * GRID_SIZE + j) * 4;
123
+ const cellX = (j + .5) / GRID_SIZE;
124
+ const cellY = (i + .5) / GRID_SIZE;
125
+ const cellDx = aspect >= 1 ? (cellX - px) * aspect : cellX - px;
126
+ const cellDy = aspect >= 1 ? cellY - py : (cellY - py) / aspect;
127
+ const dist = Math.sqrt(cellDx * cellDx + cellDy * cellDy);
128
+ if (dist < influenceRadius) {
129
+ const influence = Math.exp(-dist * dist / (radius * radius));
130
+ trailData[idx] = Math.min(1, trailData[idx] + influence * amountPerStep);
131
+ trailData[idx + 1] = 1;
132
+ trailData[idx + 2] = 0;
133
+ }
126
134
  }
127
135
  }
128
136
  }
@@ -25,7 +25,7 @@ import "./Cross-CDyzf8TT.js";
25
25
  import "./CRTScreen-DolQEkb1.js";
26
26
  import "./Crystal-DSuN8TNY.js";
27
27
  import "./CursorRipples-n_xEDr10.js";
28
- import "./CursorTrail-Dm2pOh9x.js";
28
+ import "./CursorTrail-C-0lpOV1.js";
29
29
  import "./DiamondGradient-TsOxHjg_.js";
30
30
  import "./DiffuseBlur-BqIV4JLM.js";
31
31
  import "./Dither-D_YF6z03.js";
@@ -107,7 +107,7 @@ import "./WaveDistortion-C7mIgJok.js";
107
107
  import "./Weave-DzZv1-19.js";
108
108
  import "./WebcamTexture-7SK_C_Xf.js";
109
109
  import "./ZoomBlur-DUcqnggc.js";
110
- import { t as getAllShaders } from "./shaderRegistry-DICjiu4V.js";
110
+ import { t as getAllShaders } from "./shaderRegistry-DFpnXcuC.js";
111
111
  import { Material, Mesh, MeshBasicNodeMaterial, OrthographicCamera, PlaneGeometry, SRGBColorSpace, Scene, Vector2, WebGPURenderer } from "three/webgpu";
112
112
  import { WebGLRenderer } from "three";
113
113
  import { PI, abs, add, atan, clamp, convertToTexture, cos, div, dot, float, fract, max, min, mix, mul, pow, screenUV, sign, sin, smoothstep, sqrt, step, sub, time, uniform, uv, vec2, vec3, vec4 } from "three/tsl";
@@ -25,7 +25,7 @@ import "./Cross-CDyzf8TT.js";
25
25
  import "./CRTScreen-DolQEkb1.js";
26
26
  import "./Crystal-DSuN8TNY.js";
27
27
  import "./CursorRipples-n_xEDr10.js";
28
- import "./CursorTrail-Dm2pOh9x.js";
28
+ import "./CursorTrail-C-0lpOV1.js";
29
29
  import "./DiamondGradient-TsOxHjg_.js";
30
30
  import "./DiffuseBlur-BqIV4JLM.js";
31
31
  import "./Dither-D_YF6z03.js";
@@ -107,5 +107,5 @@ import "./WaveDistortion-C7mIgJok.js";
107
107
  import "./Weave-DzZv1-19.js";
108
108
  import "./WebcamTexture-7SK_C_Xf.js";
109
109
  import "./ZoomBlur-DUcqnggc.js";
110
- import { a as shaderRegistry, i as getShadersByCategory, n as getShaderByName, r as getShaderCategories, t as getAllShaders } from "./shaderRegistry-DICjiu4V.js";
110
+ import { a as shaderRegistry, i as getShadersByCategory, n as getShaderByName, r as getShaderCategories, t as getAllShaders } from "./shaderRegistry-DFpnXcuC.js";
111
111
  export { getAllShaders, getShaderByName, getShaderCategories, getShadersByCategory, shaderRegistry };
@@ -19,7 +19,7 @@ import { n as componentDefinition$17 } from "./Cross-CDyzf8TT.js";
19
19
  import { n as componentDefinition$18 } from "./CRTScreen-DolQEkb1.js";
20
20
  import { n as componentDefinition$19 } from "./Crystal-DSuN8TNY.js";
21
21
  import { n as componentDefinition$20 } from "./CursorRipples-n_xEDr10.js";
22
- import { n as componentDefinition$21 } from "./CursorTrail-Dm2pOh9x.js";
22
+ import { n as componentDefinition$21 } from "./CursorTrail-C-0lpOV1.js";
23
23
  import { n as componentDefinition$22 } from "./DiamondGradient-TsOxHjg_.js";
24
24
  import { n as componentDefinition$23 } from "./DiffuseBlur-BqIV4JLM.js";
25
25
  import { n as componentDefinition$24 } from "./Dither-D_YF6z03.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/CursorTrail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAIvE,OAAO,EAAC,cAAc,EAAyC,MAAM,qCAAqC,CAAA;AAI1G,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CA0LnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/CursorTrail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAIvE,OAAO,EAAC,cAAc,EAAyC,MAAM,qCAAqC,CAAA;AAI1G,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CAkMnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import "../../transformations-B5lM6fYX.js";
2
2
  import "../../colorMixing-BPpDnR5I.js";
3
- import { n as componentDefinition, t as CursorTrail_default } from "../../CursorTrail-Dm2pOh9x.js";
3
+ import { n as componentDefinition, t as CursorTrail_default } from "../../CursorTrail-C-0lpOV1.js";
4
4
  export { componentDefinition, CursorTrail_default as default };
@@ -41,7 +41,7 @@ async function createShader(canvas, preset, options) {
41
41
  if (isExternalUser()) {
42
42
  const checkRendering = () => {
43
43
  if (renderer.getPerformanceStats().fps > 0) {
44
- telemetryCollector = startTelemetry(renderer, "2.5.90", options?.disableTelemetry || false, false);
44
+ telemetryCollector = startTelemetry(renderer, "2.5.91", options?.disableTelemetry || false, false);
45
45
  if (telemetryCollector) telemetryCollector.start();
46
46
  telemetryStartTimeout = null;
47
47
  } else telemetryStartTimeout = setTimeout(checkRendering, 500);
@@ -89,7 +89,7 @@ const Shader = ({ children, disableTelemetry = false, colorSpace = "p3-linear",
89
89
  return;
90
90
  }
91
91
  if (rendererRef.current.getPerformanceStats().fps > 0) {
92
- telemetryCollectorRef.current = startTelemetry(rendererRef.current, "2.5.90", disableTelemetry, isPreview);
92
+ telemetryCollectorRef.current = startTelemetry(rendererRef.current, "2.5.91", disableTelemetry, isPreview);
93
93
  if (telemetryCollectorRef.current) telemetryCollectorRef.current.start();
94
94
  telemetryStartTimeoutRef.current = null;
95
95
  } else telemetryStartTimeoutRef.current = window.setTimeout(checkRendering, 500);
@@ -67,7 +67,7 @@ function Shader(allProps) {
67
67
  const checkRendering = () => {
68
68
  const stats = rendererInstance.getPerformanceStats();
69
69
  if (stats.fps > 0) {
70
- const version = "2.5.90";
70
+ const version = "2.5.91";
71
71
  telemetryCollector = startTelemetry(rendererInstance, version, props.disableTelemetry, props.isPreview);
72
72
  if (telemetryCollector) {
73
73
  telemetryCollector.start();
@@ -14941,7 +14941,7 @@ function Shader($$anchor, $$props) {
14941
14941
  const checkRendering = () => {
14942
14942
  if (!rendererInstance) return;
14943
14943
  if (rendererInstance.getPerformanceStats().fps > 0) {
14944
- telemetryCollector = startTelemetry(rendererInstance, "2.5.90", disableTelemetry(), isPreview());
14944
+ telemetryCollector = startTelemetry(rendererInstance, "2.5.91", disableTelemetry(), isPreview());
14945
14945
  if (telemetryCollector) telemetryCollector.start();
14946
14946
  telemetryStartTimeout = null;
14947
14947
  } else telemetryStartTimeout = window.setTimeout(checkRendering, 500);
@@ -60,7 +60,7 @@ var Shader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
60
60
  const startTelemetryWhenReady = () => {
61
61
  const checkRendering = () => {
62
62
  if (rendererInstance.value.getPerformanceStats().fps > 0) {
63
- telemetryCollector = startTelemetry(rendererInstance.value, "2.5.90", props.disableTelemetry, props.isPreview);
63
+ telemetryCollector = startTelemetry(rendererInstance.value, "2.5.91", props.disableTelemetry, props.isPreview);
64
64
  if (telemetryCollector) telemetryCollector.start();
65
65
  telemetryStartTimeout = null;
66
66
  } else telemetryStartTimeout = setTimeout(checkRendering, 500);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shaders",
3
- "version": "2.5.90",
3
+ "version": "2.5.91",
4
4
  "description": "Shader magic for modern frontends",
5
5
  "author": "Shader Effects Inc.",
6
6
  "homepage": "https://shaders.com/",