@cosmictraveler002/anim-kit 1.4.0 → 1.6.0

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 (56) hide show
  1. package/README.md +256 -23
  2. package/dist/anim-kit.standalone.js +5 -5
  3. package/dist/anim-kit.standalone.js.map +1 -1
  4. package/dist/core/smooth-scroll.d.ts +29 -1
  5. package/dist/core/smooth-scroll.d.ts.map +1 -1
  6. package/dist/core/smooth-scroll.js +23 -3
  7. package/dist/core/smooth-scroll.js.map +1 -1
  8. package/dist/effects/horizontal-scroll.d.ts.map +1 -1
  9. package/dist/effects/horizontal-scroll.js +3 -0
  10. package/dist/effects/horizontal-scroll.js.map +1 -1
  11. package/dist/effects/ink-wipe.d.ts +41 -0
  12. package/dist/effects/ink-wipe.d.ts.map +1 -0
  13. package/dist/effects/ink-wipe.js +342 -0
  14. package/dist/effects/ink-wipe.js.map +1 -0
  15. package/dist/effects/scatter-text.d.ts.map +1 -1
  16. package/dist/effects/scatter-text.js +3 -0
  17. package/dist/effects/scatter-text.js.map +1 -1
  18. package/dist/effects/stacked-cards.d.ts.map +1 -1
  19. package/dist/effects/stacked-cards.js +3 -0
  20. package/dist/effects/stacked-cards.js.map +1 -1
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/three/coverflow-wheel.d.ts +26 -0
  26. package/dist/three/coverflow-wheel.d.ts.map +1 -0
  27. package/dist/three/coverflow-wheel.js +495 -0
  28. package/dist/three/coverflow-wheel.js.map +1 -0
  29. package/dist/three/dither-reveal.d.ts +36 -0
  30. package/dist/three/dither-reveal.d.ts.map +1 -0
  31. package/dist/three/dither-reveal.js +292 -0
  32. package/dist/three/dither-reveal.js.map +1 -0
  33. package/dist/three/index.d.ts +8 -0
  34. package/dist/three/index.d.ts.map +1 -1
  35. package/dist/three/index.js +4 -0
  36. package/dist/three/index.js.map +1 -1
  37. package/dist/three/tear-reveal.d.ts +54 -0
  38. package/dist/three/tear-reveal.d.ts.map +1 -0
  39. package/dist/three/tear-reveal.js +269 -0
  40. package/dist/three/tear-reveal.js.map +1 -0
  41. package/dist/three/wordmark-wave.d.ts +29 -0
  42. package/dist/three/wordmark-wave.d.ts.map +1 -0
  43. package/dist/three/wordmark-wave.js +461 -0
  44. package/dist/three/wordmark-wave.js.map +1 -0
  45. package/package.json +1 -1
  46. package/src/core/smooth-scroll.ts +44 -2
  47. package/src/effects/horizontal-scroll.ts +3 -0
  48. package/src/effects/ink-wipe.ts +409 -0
  49. package/src/effects/scatter-text.ts +3 -0
  50. package/src/effects/stacked-cards.ts +3 -0
  51. package/src/index.ts +3 -0
  52. package/src/three/coverflow-wheel.ts +569 -0
  53. package/src/three/dither-reveal.ts +365 -0
  54. package/src/three/index.ts +8 -0
  55. package/src/three/tear-reveal.ts +351 -0
  56. package/src/three/wordmark-wave.ts +517 -0
@@ -0,0 +1,269 @@
1
+ /**
2
+ * Tear reveal — a torn-edge sheet that sweeps a section in (or out).
3
+ *
4
+ * A noise-displaced boundary travels across the overlay: the fbm is added to
5
+ * the field *before* thresholding, so patches of the sheet tear away ahead of
6
+ * the front and ride across as separate shards. A barrel warp (`lens`) bows
7
+ * the boundary so it arrives as a curve — flat in the middle, sweeping at the
8
+ * edges — instead of a straight line wobbling in place.
9
+ *
10
+ * The sheet paints a flat colour or a two-stop gradient and can run
11
+ * `mix-blend-mode` (multiply tints the section's own artwork darker-red;
12
+ * normal covers it outright).
13
+ *
14
+ * Modes mirror clipWipe:
15
+ * mode "scroll" plays once when the section enters (default)
16
+ * scrub progress follows the scroll, so stopping half way leaves
17
+ * a half-torn screen — a real place to be, not a glitch
18
+ *
19
+ * Works as a page-sized overlay too: give it `document.body` with
20
+ * `position: fixed` styling via the `fixed` option for a fullscreen sweep.
21
+ *
22
+ * No WebGL (SSR, jsdom, disabled) → silent no-op; destroy() removes the
23
+ * canvas and restores the host's styles.
24
+ */
25
+ import * as THREE from "three";
26
+ import { gsap, ScrollTrigger, initGSAP } from "../core/gsap.js";
27
+ import { guard } from "../core/guard.js";
28
+ import { one } from "../core/util.js";
29
+ const VERT = /* glsl */ `
30
+ varying vec2 vUv;
31
+ void main() {
32
+ vUv = uv;
33
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
34
+ }
35
+ `;
36
+ const FRAG = /* glsl */ `
37
+ precision highp float;
38
+ varying vec2 vUv;
39
+ uniform float uP, uTime, uAspect, uOut, uLens, uDir;
40
+ uniform float uDispAmp, uDispScale, uDispDrift, uSoft;
41
+ uniform int uDetail;
42
+ uniform vec3 uTop, uFoot;
43
+
44
+ float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
45
+ float vnoise(vec2 p){
46
+ vec2 i = floor(p), f = fract(p);
47
+ vec2 u = f * f * (3.0 - 2.0 * f);
48
+ return mix(mix(hash(i), hash(i + vec2(1,0)), u.x),
49
+ mix(hash(i + vec2(0,1)), hash(i + vec2(1,1)), u.x), u.y);
50
+ }
51
+ float fbm(vec2 p, int oct){
52
+ float v = 0.0, a = 0.5;
53
+ for (int i = 0; i < 6; i++){
54
+ if (i >= oct) break;
55
+ v += a * vnoise(p); p *= 2.03; a *= 0.5;
56
+ }
57
+ return v;
58
+ }
59
+
60
+ /* Canonical sweep space: "along" grows toward the travel direction,
61
+ "cross" runs along the boundary. uDir: 0 up, 1 down, 2 left, 3 right. */
62
+ vec2 sweepSpace(vec2 uv){
63
+ if (uDir < 0.5) return vec2(uv.x, uv.y); /* up : along = y */
64
+ if (uDir < 1.5) return vec2(uv.x, 1.0 - uv.y); /* down : along = 1-y*/
65
+ if (uDir < 2.5) return vec2(uv.y, uv.x); /* right : along = x */
66
+ return vec2(uv.y, 1.0 - uv.x); /* left : along = 1-x*/
67
+ }
68
+
69
+ void main(){
70
+ bool outside = false;
71
+ vec2 uv = vUv;
72
+ if (uLens != 0.0) {
73
+ vec2 d = uv - 0.5;
74
+ vec2 w = 0.5 + d * (1.0 + uLens * dot(d, d) * 4.0);
75
+ if (w.x < 0.0 || w.x > 1.0 || w.y < 0.0 || w.y > 1.0) outside = true;
76
+ uv = w;
77
+ }
78
+ /* Corners the warp threw out of frame clamp back in: a hole here would be
79
+ a see-through patch in a sheet meant to be closed. */
80
+ if (outside) uv = clamp(uv, 0.0, 1.0);
81
+
82
+ vec2 sc = sweepSpace(uv);
83
+ float along = sc.y; /* 0 = where the sheet starts, 1 = far side */
84
+ float cross = sc.x;
85
+
86
+ /* The torn boundary: noise joins the field before the threshold, so
87
+ patches cross zero early and ride ahead as detached shards. */
88
+ float edge = mix(-uDispAmp, 1.0 + uDispAmp, uP);
89
+ float n = fbm(vec2(cross * uAspect, along) * uDispScale +
90
+ vec2(0.0, uTime * uDispDrift), uDetail) - 0.5;
91
+ float field = (edge - along) + n * uDispAmp * 2.0;
92
+ /* field > 0 is the covered side; both ends of the travel are sealed so the
93
+ last half-covered pixels never read as speckle or leftover haze. */
94
+ float a = smoothstep(-uSoft, uSoft, field);
95
+ a = max(a, smoothstep(0.985, 1.0, uP));
96
+ a = max(a, step(0.999, uP));
97
+ /* uOut = 1 makes the sheet the part that is LEAVING: the same rising edge
98
+ goes on rising and clears the screen instead of reversing downhill. */
99
+ a = mix(a, 1.0 - a, uOut);
100
+ if (a <= 0.001) discard;
101
+
102
+ vec3 col = mix(uFoot, uTop, clamp(vUv.y, 0.0, 1.0));
103
+ gl_FragColor = vec4(col, a);
104
+ }
105
+ `;
106
+ export function tearReveal(target, options = {}) {
107
+ initGSAP();
108
+ const host = one(target);
109
+ if (!host)
110
+ return () => { };
111
+ const { color = "#111111", blend = "none", direction = "up", dispAmp = 0.175, dispScale = 12.2, dispDetail = 5, dispDrift = 0, soft = 0.001, lens = -0.275, duration = 1, ease = "power2.inOut", mode = "scroll", start = "top 85%", end = "top 25%", replay = false, scrub, fixed = false, z = 1, dpr = 2, } = options;
112
+ return guard(options, () => {
113
+ /* ---------------- availability ladder (silent, no probes) ---------------- */
114
+ if (typeof window === "undefined" || !("WebGLRenderingContext" in window))
115
+ return () => { };
116
+ let renderer;
117
+ try {
118
+ renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false });
119
+ }
120
+ catch {
121
+ return () => { }; // context refused — the section simply stays as it is
122
+ }
123
+ /* ---------------- layout + styles we must restore ---------------- */
124
+ const prevPosition = host.style.position;
125
+ if (!fixed && !prevPosition && getComputedStyle(host).position === "static") {
126
+ host.style.position = "relative";
127
+ }
128
+ const w = Math.max(1, fixed ? window.innerWidth : host.clientWidth);
129
+ const h = Math.max(1, fixed ? window.innerHeight : host.clientHeight);
130
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, dpr));
131
+ renderer.setSize(w, h, false);
132
+ renderer.setClearColor(0x000000, 0);
133
+ const canvas = renderer.domElement;
134
+ canvas.style.cssText = fixed
135
+ ? `position:fixed;inset:0;width:100%;height:100%;display:block;pointer-events:none;z-index:${z};`
136
+ : `position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none;z-index:${z};`;
137
+ const stops = Array.isArray(color) ? color : [color, color];
138
+ const scene = new THREE.Scene();
139
+ const camera = new THREE.OrthographicCamera(-w / 2, w / 2, h / 2, -h / 2, -100, 100);
140
+ camera.position.z = 10;
141
+ const geometry = new THREE.PlaneGeometry(1, 1, 1, 1);
142
+ const uniforms = {
143
+ uP: { value: 0 },
144
+ uTime: { value: 0 },
145
+ uAspect: { value: direction === "up" || direction === "down" ? w / Math.max(1, h) : h / Math.max(1, w) },
146
+ uOut: { value: 0 },
147
+ uLens: { value: lens },
148
+ uDir: { value: direction === "up" ? 0 : direction === "down" ? 1 : direction === "right" ? 2 : 3 },
149
+ uDispAmp: { value: dispAmp },
150
+ uDispScale: { value: dispScale },
151
+ uDispDrift: { value: dispDrift },
152
+ uSoft: { value: soft },
153
+ uDetail: { value: dispDetail },
154
+ uTop: { value: new THREE.Color(stops[1]) },
155
+ uFoot: { value: new THREE.Color(stops[0]) },
156
+ };
157
+ const material = new THREE.ShaderMaterial({
158
+ vertexShader: VERT,
159
+ fragmentShader: FRAG,
160
+ uniforms,
161
+ transparent: true,
162
+ depthTest: false,
163
+ depthWrite: false,
164
+ });
165
+ const mesh = new THREE.Mesh(geometry, material);
166
+ mesh.scale.set(w, h, 1);
167
+ scene.add(mesh);
168
+ host.appendChild(canvas);
169
+ if (blend && blend !== "none")
170
+ canvas.style.mixBlendMode = blend;
171
+ const render = () => renderer.render(scene, camera);
172
+ /* ---------------- progress control (clipWipe's modes) ---------------- */
173
+ let tween = null;
174
+ let st = null;
175
+ let disposed = false;
176
+ const setP = (v) => {
177
+ uniforms.uP.value = v;
178
+ render();
179
+ };
180
+ if (scrub !== undefined) {
181
+ st = ScrollTrigger.create({
182
+ trigger: host,
183
+ start: fixed ? "top top" : start,
184
+ end: fixed ? "bottom bottom" : end,
185
+ scrub: scrub === true ? true : scrub,
186
+ onUpdate: (self) => setP(self.progress),
187
+ });
188
+ setP(st.progress);
189
+ }
190
+ else if (mode === "immediate") {
191
+ tween = gsap.to(uniforms.uP, {
192
+ value: 1,
193
+ duration,
194
+ ease,
195
+ onUpdate: render,
196
+ });
197
+ }
198
+ else {
199
+ st = ScrollTrigger.create({
200
+ trigger: host,
201
+ start,
202
+ end,
203
+ toggleActions: replay ? "play reverse play reverse" : "play none none none",
204
+ onEnter: () => {
205
+ tween?.kill();
206
+ tween = gsap.to(uniforms.uP, { value: 1, duration, ease, overwrite: true, onUpdate: render });
207
+ },
208
+ onLeaveBack: () => {
209
+ if (!replay)
210
+ return;
211
+ tween?.kill();
212
+ tween = gsap.to(uniforms.uP, { value: 0, duration, ease, overwrite: true, onUpdate: render });
213
+ },
214
+ });
215
+ render();
216
+ }
217
+ /* Drift only costs something when the pattern should crawl. */
218
+ const renderTime = () => {
219
+ uniforms.uTime.value = gsap.ticker.time;
220
+ render();
221
+ };
222
+ if (dispDrift > 0)
223
+ gsap.ticker.add(renderTime);
224
+ /* ---------------- resize ---------------- */
225
+ let ro = null;
226
+ const resize = () => {
227
+ const rw = Math.max(1, fixed ? window.innerWidth : host.clientWidth);
228
+ const rh = Math.max(1, fixed ? window.innerHeight : host.clientHeight);
229
+ renderer.setSize(rw, rh, false);
230
+ camera.left = -rw / 2;
231
+ camera.right = rw / 2;
232
+ camera.top = rh / 2;
233
+ camera.bottom = -rh / 2;
234
+ camera.updateProjectionMatrix();
235
+ mesh.scale.set(rw, rh, 1);
236
+ uniforms.uAspect.value =
237
+ direction === "up" || direction === "down" ? rw / Math.max(1, rh) : rh / Math.max(1, rw);
238
+ render();
239
+ };
240
+ if (typeof ResizeObserver === "function") {
241
+ ro = new ResizeObserver(resize);
242
+ ro.observe(fixed ? document.body : host);
243
+ }
244
+ if (fixed)
245
+ window.addEventListener("resize", resize);
246
+ ScrollTrigger.refresh();
247
+ /* ---------------- teardown ---------------- */
248
+ return () => {
249
+ if (disposed)
250
+ return;
251
+ disposed = true;
252
+ if (dispDrift > 0)
253
+ gsap.ticker.remove(renderTime);
254
+ tween?.kill();
255
+ gsap.killTweensOf(uniforms.uP);
256
+ st?.kill();
257
+ ro?.disconnect();
258
+ if (fixed)
259
+ window.removeEventListener("resize", resize);
260
+ geometry.dispose();
261
+ material.dispose();
262
+ renderer.dispose();
263
+ canvas.remove();
264
+ host.style.position = prevPosition;
265
+ ScrollTrigger.refresh();
266
+ };
267
+ });
268
+ }
269
+ //# sourceMappingURL=tear-reveal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tear-reveal.js","sourceRoot":"","sources":["../../src/three/tear-reveal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,iB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Q,EAAE,MAAM,CAAC,CAAC;YACxD,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC;YACnC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { CommonOptions, Destroy, TargetLike } from "../core/types.js";
2
+ export interface WordmarkWaveOptions extends CommonOptions {
3
+ /** Text to draw — defaults to the target's own (trimmed) text. */
4
+ text?: string;
5
+ /** CSS font shorthand; defaults to the target's computed font. */
6
+ font?: string;
7
+ /** Base colour; defaults to the target's computed colour. */
8
+ color?: string;
9
+ /** Overall opacity. @default 1 */
10
+ opacity?: number;
11
+ /** Stroke width, px, for an outlined wordmark — 0 = filled. @default 0 */
12
+ outline?: number;
13
+ /** Extra letter spacing, px. @default 0 */
14
+ tracking?: number;
15
+ /** Pointer-velocity ("drag") term of the sim. @default 1 */
16
+ drag?: number;
17
+ /** Radial push term — vertices flee the cursor while it sits still. @default 0 */
18
+ push?: number;
19
+ /** Red/cyan chromatic split while deforming. @default true */
20
+ chroma?: boolean;
21
+ /** Device-pixel-ratio cap for both canvases. @default 2 */
22
+ dpr?: number;
23
+ /** Horizontal grid columns — auto (≈10 px cells) when omitted. */
24
+ segments?: number;
25
+ /** Canvas stacking order. @default 1 */
26
+ z?: number;
27
+ }
28
+ export declare function wordmarkWave(target: TargetLike, options?: WordmarkWaveOptions): Destroy;
29
+ //# sourceMappingURL=wordmark-wave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wordmark-wave.d.ts","sourceRoot":"","sources":["../../src/three/wordmark-wave.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AA8DD,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CA+X3F"}