@cosmictraveler002/anim-kit 1.5.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.
- package/README.md +245 -21
- package/dist/anim-kit.standalone.js +5 -5
- package/dist/anim-kit.standalone.js.map +1 -1
- package/dist/effects/horizontal-scroll.d.ts.map +1 -1
- package/dist/effects/horizontal-scroll.js +3 -0
- package/dist/effects/horizontal-scroll.js.map +1 -1
- package/dist/effects/ink-wipe.d.ts +41 -0
- package/dist/effects/ink-wipe.d.ts.map +1 -0
- package/dist/effects/ink-wipe.js +342 -0
- package/dist/effects/ink-wipe.js.map +1 -0
- package/dist/effects/scatter-text.d.ts.map +1 -1
- package/dist/effects/scatter-text.js +3 -0
- package/dist/effects/scatter-text.js.map +1 -1
- package/dist/effects/stacked-cards.d.ts.map +1 -1
- package/dist/effects/stacked-cards.js +3 -0
- package/dist/effects/stacked-cards.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/three/coverflow-wheel.d.ts +26 -0
- package/dist/three/coverflow-wheel.d.ts.map +1 -0
- package/dist/three/coverflow-wheel.js +495 -0
- package/dist/three/coverflow-wheel.js.map +1 -0
- package/dist/three/dither-reveal.d.ts +36 -0
- package/dist/three/dither-reveal.d.ts.map +1 -0
- package/dist/three/dither-reveal.js +292 -0
- package/dist/three/dither-reveal.js.map +1 -0
- package/dist/three/index.d.ts +8 -0
- package/dist/three/index.d.ts.map +1 -1
- package/dist/three/index.js +4 -0
- package/dist/three/index.js.map +1 -1
- package/dist/three/tear-reveal.d.ts +54 -0
- package/dist/three/tear-reveal.d.ts.map +1 -0
- package/dist/three/tear-reveal.js +269 -0
- package/dist/three/tear-reveal.js.map +1 -0
- package/dist/three/wordmark-wave.d.ts +29 -0
- package/dist/three/wordmark-wave.d.ts.map +1 -0
- package/dist/three/wordmark-wave.js +461 -0
- package/dist/three/wordmark-wave.js.map +1 -0
- package/package.json +1 -1
- package/src/effects/horizontal-scroll.ts +3 -0
- package/src/effects/ink-wipe.ts +409 -0
- package/src/effects/scatter-text.ts +3 -0
- package/src/effects/stacked-cards.ts +3 -0
- package/src/index.ts +3 -0
- package/src/three/coverflow-wheel.ts +569 -0
- package/src/three/dither-reveal.ts +365 -0
- package/src/three/index.ts +8 -0
- package/src/three/tear-reveal.ts +351 -0
- package/src/three/wordmark-wave.ts +517 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverflow wheel — a deck of `<img>` cards riding a flattened spinning
|
|
3
|
+
* wheel: the front card faces you, its neighbours curve away to both sides,
|
|
4
|
+
* the far half of the wheel shows the blurred, dimmed card *backs*, and the
|
|
5
|
+
* whole strip dissolves into the bottom of the screen.
|
|
6
|
+
*
|
|
7
|
+
* - **Cards bend along the arc.** Each card's geometry spans exactly one
|
|
8
|
+
* slot, so every vertex is placed on the circle from its own angle —
|
|
9
|
+
* `circleProgress = −(slot + x·stride) + progress + ¼`, `angle = 2π·cp`,
|
|
10
|
+
* `x = cos(angle)·r`, `z = sin(angle)·r·0.5` — which is why the side
|
|
11
|
+
* cards visibly curve; a stack of rigid `rotateY` planes would not.
|
|
12
|
+
* The radius follows the deck, `r = 1/(2·sin(π/N))`, so the wheel
|
|
13
|
+
* tightens as cards are added.
|
|
14
|
+
* - **One scalar drives everything.** `progress` is unbounded and one full
|
|
15
|
+
* unit equals one trip around the wheel (N cards): while idle the wheel
|
|
16
|
+
* creeps an eighth of a slot toward the next card over `idle` seconds,
|
|
17
|
+
* then eases the rest of the way (`power2.inOut`, `duration`), dragging
|
|
18
|
+
* maps `−(dx/width)·0.15` onto it, and a release past `0.05·step`
|
|
19
|
+
* commits to the neighbour you pulled toward — anything less springs
|
|
20
|
+
* back over 0.3 s. `goTo/next/prev` always land on the shortest path.
|
|
21
|
+
* - **Parallax is a quaternion**: the wheel node slerps toward a small
|
|
22
|
+
* yaw/pitch built from the pointer at `dt·5` a frame, and dragging
|
|
23
|
+
* squeezes the whole wheel by `1 − 0.02·easeInOutCubic(dragTime)`.
|
|
24
|
+
* - **Silent no-op ladder.** Missing target / fewer than two card images /
|
|
25
|
+
* no `WebGLRenderingContext` / `prefers-reduced-motion` → an inert
|
|
26
|
+
* handle, the plain images left exactly where they are. Images that
|
|
27
|
+
* fail to decode drop out of the wheel; if fewer than two survive,
|
|
28
|
+
* nothing mounts. Off-screen wheels stop ticking (IntersectionObserver),
|
|
29
|
+
* so the autoplay never advances unseen.
|
|
30
|
+
* - **Fidelity.** The camera is a *horizontal* 35° FOV converted to
|
|
31
|
+
* three's vertical one (near 0.1, far 10); the wheel node sits at
|
|
32
|
+
* `y −0.1, z −(2r) −0.8, rotateX −0.18, rotateZ 0.12`; back faces
|
|
33
|
+
* sample one mip of blur at half rgb; cards fade out below NDC −0.8.
|
|
34
|
+
* `destroy()` kills the tween/ticker/observers/listeners, disposes the
|
|
35
|
+
* GL objects and restores every style it touched — including the card
|
|
36
|
+
* opacities.
|
|
37
|
+
*
|
|
38
|
+
* coverflowWheel("#deck", { autoplay: false }).goTo(3)
|
|
39
|
+
*
|
|
40
|
+
* Markup: a container holding two or more `<img>` cards:
|
|
41
|
+
*
|
|
42
|
+
* <div class="hero__deck"><img src="card-01.jpg" alt="" /> …</div>
|
|
43
|
+
*/
|
|
44
|
+
import * as THREE from "three";
|
|
45
|
+
import { gsap, initGSAP } from "../core/gsap.js";
|
|
46
|
+
import { one, prefersReducedMotion } from "../core/util.js";
|
|
47
|
+
const VERT = /* glsl */ `
|
|
48
|
+
uniform float uProgress;
|
|
49
|
+
uniform float uSlot;
|
|
50
|
+
uniform float uStride;
|
|
51
|
+
uniform float uRadius;
|
|
52
|
+
uniform float uMargin;
|
|
53
|
+
|
|
54
|
+
varying vec2 vUv;
|
|
55
|
+
varying float vNdcY;
|
|
56
|
+
|
|
57
|
+
void main() {
|
|
58
|
+
/* Geometry spans one stride, so each card bends along the arc instead of
|
|
59
|
+
staying a rigid plane — position.x picks the vertex's spot on the wheel
|
|
60
|
+
before being replaced by the circle itself. */
|
|
61
|
+
vec2 p = position.xy * (1.0 - uMargin);
|
|
62
|
+
float circleProgress = -(uSlot + p.x * uStride) + uProgress + 0.25;
|
|
63
|
+
float angle = circleProgress * 6.28318530718;
|
|
64
|
+
vec3 arc = vec3(cos(angle) * uRadius, p.y, sin(angle) * uRadius * 0.5);
|
|
65
|
+
|
|
66
|
+
vec4 clip = projectionMatrix * modelViewMatrix * vec4(arc, 1.0);
|
|
67
|
+
vUv = uv;
|
|
68
|
+
vNdcY = clip.y / clip.w;
|
|
69
|
+
gl_Position = clip;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
const FRAG = /* glsl */ `
|
|
73
|
+
precision highp float;
|
|
74
|
+
|
|
75
|
+
uniform sampler2D uMap;
|
|
76
|
+
|
|
77
|
+
varying vec2 vUv;
|
|
78
|
+
varying float vNdcY;
|
|
79
|
+
|
|
80
|
+
void main() {
|
|
81
|
+
/* The wheel's far half shows card BACKS: mirrored, one mip of blur,
|
|
82
|
+
rgb at half — and every card dissolves into the strip below NDC −0.8
|
|
83
|
+
instead of ending on a hard edge. */
|
|
84
|
+
vec2 tc = vUv;
|
|
85
|
+
tc.x = gl_FrontFacing ? tc.x : 1.0 - tc.x;
|
|
86
|
+
float isFront = gl_FrontFacing ? 0.0 : 1.0;
|
|
87
|
+
|
|
88
|
+
vec4 sharp = texture2D(uMap, tc);
|
|
89
|
+
vec4 blur = texture2D(uMap, tc, 1.0);
|
|
90
|
+
vec4 col = mix(blur, sharp, isFront);
|
|
91
|
+
col.rgb *= 0.5 + isFront * 0.5;
|
|
92
|
+
col.a *= clamp(smoothstep(-1.0, -0.8, vNdcY), 0.0, 1.0);
|
|
93
|
+
gl_FragColor = col;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
/** Handles from the silent no-op ladder — every call is safe. */
|
|
97
|
+
const INERT = {
|
|
98
|
+
goTo: () => { },
|
|
99
|
+
next: () => { },
|
|
100
|
+
prev: () => { },
|
|
101
|
+
destroy: () => { },
|
|
102
|
+
};
|
|
103
|
+
const mod = (n, m) => ((n % m) + m) % m;
|
|
104
|
+
const clamp01 = (v) => (v < 0 ? 0 : v > 1 ? 1 : v);
|
|
105
|
+
const easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
106
|
+
/** three wants a vertical FOV; the reference camera is specified horizontally. */
|
|
107
|
+
const vfovFor = (aspect) => (2 * Math.atan(Math.tan((35 / 2) * (Math.PI / 180)) / aspect) * 180) / Math.PI;
|
|
108
|
+
export function coverflowWheel(target, options = {}) {
|
|
109
|
+
initGSAP();
|
|
110
|
+
const host = one(target);
|
|
111
|
+
if (!host)
|
|
112
|
+
return INERT;
|
|
113
|
+
if (prefersReducedMotion() && !options.force)
|
|
114
|
+
return INERT;
|
|
115
|
+
const { index = 0, autoplay = true, idle = 5, duration = 1.15, margin = 0.1, dpr = 2, } = options;
|
|
116
|
+
/* ---------------- availability ladder (silent, no probes) ---------------- */
|
|
117
|
+
if (typeof window === "undefined" || !("WebGLRenderingContext" in window)) {
|
|
118
|
+
return INERT;
|
|
119
|
+
}
|
|
120
|
+
let renderer;
|
|
121
|
+
try {
|
|
122
|
+
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return INERT; // context refused — plain images stay
|
|
126
|
+
}
|
|
127
|
+
const imgs = Array.from(host.querySelectorAll("img"));
|
|
128
|
+
if (imgs.length < 2) {
|
|
129
|
+
renderer.dispose();
|
|
130
|
+
return INERT;
|
|
131
|
+
}
|
|
132
|
+
/* ---------------- scene (card count lands after decode) ---------------- */
|
|
133
|
+
let w = Math.max(1, host.clientWidth);
|
|
134
|
+
let h = Math.max(1, host.clientHeight);
|
|
135
|
+
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, dpr));
|
|
136
|
+
renderer.setSize(w, h, false);
|
|
137
|
+
const canvas = renderer.domElement;
|
|
138
|
+
canvas.style.cssText =
|
|
139
|
+
"position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none;";
|
|
140
|
+
const scene = new THREE.Scene();
|
|
141
|
+
const camera = new THREE.PerspectiveCamera(vfovFor(w / h), w / h, 0.1, 10);
|
|
142
|
+
/* 40 verts / 114 indices, aspect 5:3 — the reference card mesh. */
|
|
143
|
+
const geometry = new THREE.PlaneGeometry(1, 0.6, 19, 1);
|
|
144
|
+
const node = new THREE.Group(); // pose + drag squeeze
|
|
145
|
+
const sway = new THREE.Group(); // pointer parallax
|
|
146
|
+
node.add(sway);
|
|
147
|
+
scene.add(node);
|
|
148
|
+
const shared = {
|
|
149
|
+
uProgress: { value: 0 },
|
|
150
|
+
uStride: { value: 0 },
|
|
151
|
+
uRadius: { value: 1 },
|
|
152
|
+
uMargin: { value: margin },
|
|
153
|
+
};
|
|
154
|
+
const materials = [];
|
|
155
|
+
const textures = [];
|
|
156
|
+
/* ---------------- state ---------------- */
|
|
157
|
+
let disposed = false;
|
|
158
|
+
let ready = false;
|
|
159
|
+
let visible = true;
|
|
160
|
+
let N = 0;
|
|
161
|
+
let step = 0; // one card slot of progress (1/N)
|
|
162
|
+
let progress = 0; // continuous; card i is front when progress ≡ i/N
|
|
163
|
+
let currentCard = mod(Math.round(index), imgs.length);
|
|
164
|
+
let mode = 0; // 0 idle · 1 tween · 2 drag
|
|
165
|
+
let idleTime = 0;
|
|
166
|
+
let dragStartProgress = 0;
|
|
167
|
+
let dragStartX = 0;
|
|
168
|
+
let dragDelta = 0;
|
|
169
|
+
let dragTime = 0;
|
|
170
|
+
let active = null;
|
|
171
|
+
let rawX = 0;
|
|
172
|
+
let rawY = 0; // pointer, element-normalised [-1, 1]
|
|
173
|
+
let tween = null;
|
|
174
|
+
const proxy = { v: 0 };
|
|
175
|
+
const swayEuler = new THREE.Euler();
|
|
176
|
+
const swayTarget = new THREE.Quaternion();
|
|
177
|
+
/* ---------------- style hooks we must restore ---------------- */
|
|
178
|
+
const prevPosition = host.style.position;
|
|
179
|
+
const prevCursor = host.style.cursor;
|
|
180
|
+
const prevTouchAction = host.style.touchAction;
|
|
181
|
+
const prevUserSelect = host.style.userSelect;
|
|
182
|
+
const prevImgOpacity = [];
|
|
183
|
+
let styled = false;
|
|
184
|
+
const applyStyles = () => {
|
|
185
|
+
if (!prevPosition && getComputedStyle(host).position === "static") {
|
|
186
|
+
host.style.position = "relative";
|
|
187
|
+
}
|
|
188
|
+
host.style.cursor = "grab";
|
|
189
|
+
host.style.touchAction = "pan-y"; // vertical scroll stays native
|
|
190
|
+
host.style.userSelect = "none";
|
|
191
|
+
host.dataset.akCoverflow = "true";
|
|
192
|
+
prevImgOpacity.length = 0;
|
|
193
|
+
for (const im of imgs) {
|
|
194
|
+
prevImgOpacity.push(im.style.opacity);
|
|
195
|
+
im.style.opacity = "0"; // the canvas owns the pixels now
|
|
196
|
+
}
|
|
197
|
+
styled = true;
|
|
198
|
+
};
|
|
199
|
+
/* ---------------- navigation ---------------- */
|
|
200
|
+
const goTo = (cardIndex, tweenDuration) => {
|
|
201
|
+
const wanted = Math.round(cardIndex);
|
|
202
|
+
if (!ready) {
|
|
203
|
+
currentCard = mod(wanted, Math.max(2, imgs.length));
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
currentCard = mod(wanted, N);
|
|
207
|
+
const base = currentCard * step;
|
|
208
|
+
/* Shortest path: the target ± one lap, whichever is nearer. */
|
|
209
|
+
const target = base + Math.round(progress - base);
|
|
210
|
+
mode = 1;
|
|
211
|
+
idleTime = 0;
|
|
212
|
+
tween?.kill();
|
|
213
|
+
proxy.v = progress;
|
|
214
|
+
tween = gsap.to(proxy, {
|
|
215
|
+
v: target,
|
|
216
|
+
duration: tweenDuration ?? duration,
|
|
217
|
+
ease: "power2.inOut",
|
|
218
|
+
overwrite: true,
|
|
219
|
+
onUpdate: () => {
|
|
220
|
+
progress = proxy.v;
|
|
221
|
+
},
|
|
222
|
+
onComplete: () => {
|
|
223
|
+
progress = target;
|
|
224
|
+
tween = null;
|
|
225
|
+
mode = 0;
|
|
226
|
+
idleTime = 0;
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
const rollback = () => {
|
|
231
|
+
mode = 1;
|
|
232
|
+
idleTime = 0;
|
|
233
|
+
tween?.kill();
|
|
234
|
+
proxy.v = progress;
|
|
235
|
+
tween = gsap.to(proxy, {
|
|
236
|
+
v: dragStartProgress,
|
|
237
|
+
duration: 0.3,
|
|
238
|
+
ease: "power2.inOut",
|
|
239
|
+
overwrite: true,
|
|
240
|
+
onUpdate: () => {
|
|
241
|
+
progress = proxy.v;
|
|
242
|
+
},
|
|
243
|
+
onComplete: () => {
|
|
244
|
+
progress = dragStartProgress;
|
|
245
|
+
tween = null;
|
|
246
|
+
mode = 0;
|
|
247
|
+
idleTime = 0;
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
const next = (tweenDuration) => goTo(currentCard + 1, tweenDuration ?? 0.5);
|
|
252
|
+
const prev = (tweenDuration) => goTo(currentCard - 1, tweenDuration ?? 0.5);
|
|
253
|
+
/* ---------------- texture build (after every card decodes) ---------------- */
|
|
254
|
+
/** object-fit: cover — crop the source into a 5:3 layer on a 2D canvas. */
|
|
255
|
+
const coverCrop = (img, lw, lh) => {
|
|
256
|
+
const c = document.createElement("canvas");
|
|
257
|
+
c.width = lw;
|
|
258
|
+
c.height = lh;
|
|
259
|
+
const g = c.getContext("2d");
|
|
260
|
+
const s = Math.max(lw / img.naturalWidth, lh / img.naturalHeight);
|
|
261
|
+
const dw = img.naturalWidth * s;
|
|
262
|
+
const dh = img.naturalHeight * s;
|
|
263
|
+
g.drawImage(img, (lw - dw) / 2, (lh - dh) / 2, dw, dh);
|
|
264
|
+
const tex = new THREE.CanvasTexture(c);
|
|
265
|
+
// No colourSpace decode: the raw fragment passes sampled values through
|
|
266
|
+
// (same rule as ditherReveal — the upload stays an ordinary RGBA8).
|
|
267
|
+
tex.minFilter = THREE.LinearMipmapLinearFilter; // back faces bias one mip
|
|
268
|
+
tex.magFilter = THREE.LinearFilter;
|
|
269
|
+
return tex;
|
|
270
|
+
};
|
|
271
|
+
const settle = (im) => {
|
|
272
|
+
if (typeof im.decode === "function") {
|
|
273
|
+
return im
|
|
274
|
+
.decode()
|
|
275
|
+
.then(() => im)
|
|
276
|
+
.catch(() => null);
|
|
277
|
+
}
|
|
278
|
+
if (im.complete)
|
|
279
|
+
return Promise.resolve(im.naturalWidth ? im : null);
|
|
280
|
+
return new Promise((resolve) => {
|
|
281
|
+
const done = () => {
|
|
282
|
+
im.removeEventListener("load", done);
|
|
283
|
+
im.removeEventListener("error", done);
|
|
284
|
+
resolve(im.naturalWidth ? im : null);
|
|
285
|
+
};
|
|
286
|
+
im.addEventListener("load", done);
|
|
287
|
+
im.addEventListener("error", done);
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
let mounted = [];
|
|
291
|
+
void (async () => {
|
|
292
|
+
const settled = await Promise.all(imgs.map(settle));
|
|
293
|
+
const loaded = settled.filter((im) => im !== null);
|
|
294
|
+
if (disposed)
|
|
295
|
+
return;
|
|
296
|
+
if (loaded.length < 2)
|
|
297
|
+
return; // nothing usable — the plain images stay
|
|
298
|
+
mounted = loaded;
|
|
299
|
+
/* A layout can still be 0×0 (display:none) at this point — read it fresh. */
|
|
300
|
+
w = Math.max(1, host.clientWidth);
|
|
301
|
+
h = Math.max(1, host.clientHeight);
|
|
302
|
+
renderer.setSize(w, h, false);
|
|
303
|
+
camera.aspect = w / h;
|
|
304
|
+
camera.fov = vfovFor(camera.aspect);
|
|
305
|
+
camera.updateProjectionMatrix();
|
|
306
|
+
N = loaded.length;
|
|
307
|
+
step = 1 / N;
|
|
308
|
+
currentCard = mod(currentCard, N);
|
|
309
|
+
/* Layer budget: the front card ≈ 0.55 of the host at up to 1024 px,
|
|
310
|
+
never more than ~6 M texels across the whole deck (mips included). */
|
|
311
|
+
const dprEff = Math.min(window.devicePixelRatio || 1, dpr);
|
|
312
|
+
const budget = Math.round(Math.sqrt(6e6 / (N * 0.6)));
|
|
313
|
+
const lw = Math.max(256, Math.min(1024, Math.round(w * 0.6 * dprEff), budget));
|
|
314
|
+
const lh = Math.round(lw * 0.6);
|
|
315
|
+
loaded.forEach((im, i) => {
|
|
316
|
+
const tex = coverCrop(im, lw, lh);
|
|
317
|
+
textures.push(tex);
|
|
318
|
+
const material = new THREE.ShaderMaterial({
|
|
319
|
+
vertexShader: VERT,
|
|
320
|
+
fragmentShader: FRAG,
|
|
321
|
+
uniforms: {
|
|
322
|
+
uProgress: shared.uProgress,
|
|
323
|
+
uStride: shared.uStride,
|
|
324
|
+
uRadius: shared.uRadius,
|
|
325
|
+
uMargin: shared.uMargin,
|
|
326
|
+
uSlot: { value: i * (1 / N) },
|
|
327
|
+
uMap: { value: tex },
|
|
328
|
+
},
|
|
329
|
+
side: THREE.DoubleSide,
|
|
330
|
+
transparent: true,
|
|
331
|
+
});
|
|
332
|
+
materials.push(material);
|
|
333
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
334
|
+
mesh.frustumCulled = false; // the vertex shader picks every position
|
|
335
|
+
sway.add(mesh);
|
|
336
|
+
});
|
|
337
|
+
const radius = 1 / (2 * Math.sin(Math.PI / N));
|
|
338
|
+
shared.uStride.value = step;
|
|
339
|
+
shared.uRadius.value = radius;
|
|
340
|
+
node.position.set(0, -0.1, -(2 * radius) - 0.8);
|
|
341
|
+
node.rotation.set(-0.18, 0, 0.12);
|
|
342
|
+
progress = currentCard * step;
|
|
343
|
+
idleTime = 0;
|
|
344
|
+
mode = 0;
|
|
345
|
+
applyStyles();
|
|
346
|
+
host.appendChild(canvas);
|
|
347
|
+
ready = true;
|
|
348
|
+
shared.uProgress.value = progress;
|
|
349
|
+
if (visible)
|
|
350
|
+
renderer.render(scene, camera);
|
|
351
|
+
})();
|
|
352
|
+
/* ---------------- pointer: parallax + drag ---------------- */
|
|
353
|
+
const onMove = (e) => {
|
|
354
|
+
const r = host.getBoundingClientRect();
|
|
355
|
+
if (r.width > 1 && r.height > 1) {
|
|
356
|
+
rawX = Math.max(-1, Math.min(1, ((e.clientX - r.left) / r.width) * 2 - 1));
|
|
357
|
+
rawY = Math.max(-1, Math.min(1, 1 - ((e.clientY - r.top) / r.height) * 2));
|
|
358
|
+
}
|
|
359
|
+
if (ready && mode === 2 && e.pointerId === active) {
|
|
360
|
+
dragDelta = ((e.clientX - dragStartX) / w) * 0.15;
|
|
361
|
+
progress = dragStartProgress - dragDelta;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
const onDown = (e) => {
|
|
365
|
+
if (!ready || active !== null || e.button !== 0)
|
|
366
|
+
return;
|
|
367
|
+
active = e.pointerId;
|
|
368
|
+
mode = 2; // grab: kill whatever was animating and anchor to where we are
|
|
369
|
+
idleTime = 0;
|
|
370
|
+
tween?.kill();
|
|
371
|
+
tween = null;
|
|
372
|
+
dragStartProgress = progress;
|
|
373
|
+
dragStartX = e.clientX;
|
|
374
|
+
dragDelta = 0;
|
|
375
|
+
currentCard = mod(Math.round(progress * N), N);
|
|
376
|
+
host.style.cursor = "grabbing";
|
|
377
|
+
host.setPointerCapture?.(e.pointerId);
|
|
378
|
+
};
|
|
379
|
+
const onUp = (e) => {
|
|
380
|
+
if (e.pointerId !== active)
|
|
381
|
+
return;
|
|
382
|
+
active = null;
|
|
383
|
+
host.style.cursor = "grab";
|
|
384
|
+
if (mode !== 2)
|
|
385
|
+
return; // a programmatic goTo() won the race
|
|
386
|
+
if (Math.abs(dragDelta) > 0.05 * step) {
|
|
387
|
+
/* Fling: commit to the neighbour the pull was heading for —
|
|
388
|
+
dragged right (progress fell) settles one slot back. */
|
|
389
|
+
goTo(currentCard + (dragDelta > 0 ? -1 : 1), 0.5);
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
rollback(); // barely moved — spring back to where the grab began
|
|
393
|
+
}
|
|
394
|
+
dragDelta = 0;
|
|
395
|
+
};
|
|
396
|
+
const onLeave = () => {
|
|
397
|
+
if (mode !== 2) {
|
|
398
|
+
rawX = 0;
|
|
399
|
+
rawY = 0; // pointer gone: the wheel levels out
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
/* Native <img> drag-and-drop would swallow the pointer stream the moment
|
|
403
|
+
a drag starts (pointercancel) — our cards are dragged, not the images. */
|
|
404
|
+
const onDragStart = (e) => e.preventDefault();
|
|
405
|
+
host.addEventListener("pointermove", onMove);
|
|
406
|
+
host.addEventListener("pointerdown", onDown);
|
|
407
|
+
host.addEventListener("pointerleave", onLeave);
|
|
408
|
+
host.addEventListener("dragstart", onDragStart);
|
|
409
|
+
window.addEventListener("pointerup", onUp);
|
|
410
|
+
window.addEventListener("pointercancel", onUp);
|
|
411
|
+
/* ---------------- loop / observers ---------------- */
|
|
412
|
+
const tick = (_time, dtMs) => {
|
|
413
|
+
if (disposed || !ready || !visible)
|
|
414
|
+
return;
|
|
415
|
+
let dt = dtMs / 1000;
|
|
416
|
+
if (dt > 0.2 || dt <= 0)
|
|
417
|
+
dt = 1 / 60; // a suspended tab must not jump the wheel
|
|
418
|
+
if (mode === 0 && autoplay) {
|
|
419
|
+
/* Idle: creep an eighth of a slot over `idle` seconds, then advance. */
|
|
420
|
+
idleTime += dt;
|
|
421
|
+
progress = currentCard * step + Math.min(idleTime / idle, 1) * step * 0.125;
|
|
422
|
+
if (idleTime >= idle)
|
|
423
|
+
goTo((currentCard + 1) % N);
|
|
424
|
+
}
|
|
425
|
+
/* Parallax — one slerp toward the pointer's yaw/pitch per frame. */
|
|
426
|
+
swayEuler.set(0.05 * rawY, -0.05 * rawX, 0);
|
|
427
|
+
swayTarget.setFromEuler(swayEuler);
|
|
428
|
+
sway.quaternion.slerp(swayTarget, Math.min(1, dt * 5));
|
|
429
|
+
/* Drag squeeze — the whole wheel shrinks 2 % while held. */
|
|
430
|
+
dragTime = clamp01(dragTime + (mode === 2 ? 5 : -5) * dt);
|
|
431
|
+
node.scale.setScalar(1 - 0.02 * easeInOutCubic(dragTime));
|
|
432
|
+
shared.uProgress.value = progress;
|
|
433
|
+
renderer.render(scene, camera);
|
|
434
|
+
};
|
|
435
|
+
gsap.ticker.add(tick);
|
|
436
|
+
let io = null;
|
|
437
|
+
if (typeof IntersectionObserver === "function") {
|
|
438
|
+
io = new IntersectionObserver(([entry]) => (visible = entry.isIntersecting), {
|
|
439
|
+
rootMargin: "120px",
|
|
440
|
+
});
|
|
441
|
+
io.observe(host);
|
|
442
|
+
}
|
|
443
|
+
let ro = null;
|
|
444
|
+
const resize = () => {
|
|
445
|
+
const rw = Math.max(1, host.clientWidth);
|
|
446
|
+
const rh = Math.max(1, host.clientHeight);
|
|
447
|
+
if (rw === w && rh === h)
|
|
448
|
+
return;
|
|
449
|
+
w = rw;
|
|
450
|
+
h = rh;
|
|
451
|
+
renderer.setSize(w, h, false);
|
|
452
|
+
camera.aspect = w / h;
|
|
453
|
+
camera.fov = vfovFor(camera.aspect);
|
|
454
|
+
camera.updateProjectionMatrix();
|
|
455
|
+
};
|
|
456
|
+
if (typeof ResizeObserver === "function") {
|
|
457
|
+
ro = new ResizeObserver(resize);
|
|
458
|
+
ro.observe(host);
|
|
459
|
+
}
|
|
460
|
+
/* ---------------- teardown ---------------- */
|
|
461
|
+
const destroy = () => {
|
|
462
|
+
if (disposed)
|
|
463
|
+
return;
|
|
464
|
+
disposed = true;
|
|
465
|
+
gsap.ticker.remove(tick);
|
|
466
|
+
tween?.kill();
|
|
467
|
+
tween = null;
|
|
468
|
+
io?.disconnect();
|
|
469
|
+
ro?.disconnect();
|
|
470
|
+
host.removeEventListener("pointermove", onMove);
|
|
471
|
+
host.removeEventListener("pointerdown", onDown);
|
|
472
|
+
host.removeEventListener("pointerleave", onLeave);
|
|
473
|
+
host.removeEventListener("dragstart", onDragStart);
|
|
474
|
+
window.removeEventListener("pointerup", onUp);
|
|
475
|
+
window.removeEventListener("pointercancel", onUp);
|
|
476
|
+
if (styled) {
|
|
477
|
+
for (let i = 0; i < mounted.length; i++)
|
|
478
|
+
mounted[i].style.opacity = prevImgOpacity[i] ?? "";
|
|
479
|
+
host.style.position = prevPosition;
|
|
480
|
+
host.style.cursor = prevCursor;
|
|
481
|
+
host.style.touchAction = prevTouchAction;
|
|
482
|
+
host.style.userSelect = prevUserSelect;
|
|
483
|
+
delete host.dataset.akCoverflow;
|
|
484
|
+
canvas.remove();
|
|
485
|
+
}
|
|
486
|
+
geometry.dispose();
|
|
487
|
+
for (const m of materials)
|
|
488
|
+
m.dispose();
|
|
489
|
+
for (const t of textures)
|
|
490
|
+
t.dispose();
|
|
491
|
+
renderer.dispose();
|
|
492
|
+
};
|
|
493
|
+
return { goTo, next, prev, destroy };
|
|
494
|
+
}
|
|
495
|
+
//# sourceMappingURL=coverflow-wheel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverflow-wheel.js","sourceRoot":"","sources":["../../src/three/coverflow-wheel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AA4B5D,MAAM,IAAI,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAwBvB,CAAC;AAEF,MAAM,IAAI,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAuBvB,CAAC;AAEF,iEAAiE;AACjE,MAAM,KAAK,GAAyB;IAClC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,GAA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AC,WAAW,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC9C,MAAM,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5F,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC;YACnC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,cAAc,CAAC;YACvC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YAChC,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;QACD,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,MAAM,CAAC,IAAI,SAAS;YAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACvC,KAAK,MAAM,CAAC,IAAI,QAAQ;YAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACtC,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CommonOptions, Destroy, TargetLike } from "../core/types.js";
|
|
2
|
+
export interface DitherRevealOptions extends CommonOptions {
|
|
3
|
+
/** Image source — defaults to the wrapper's first `<img>`. */
|
|
4
|
+
src?: string;
|
|
5
|
+
/** Reveal duration, seconds. @default 1.15 */
|
|
6
|
+
duration?: number;
|
|
7
|
+
/** GSAP ease for the reveal. @default "power4.out" */
|
|
8
|
+
ease?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Flat placeholder colour shown where the mask has not opened yet
|
|
11
|
+
* (their "develop" plate). Omit to let the wrapper's own background
|
|
12
|
+
* show through the not-yet-revealed area.
|
|
13
|
+
*/
|
|
14
|
+
plate?: string;
|
|
15
|
+
/** fbm frequency across the element — the lump scale of the edge. @default 50 */
|
|
16
|
+
maskScale?: number;
|
|
17
|
+
/**
|
|
18
|
+
* How far (in normalised radius) the noise can push the boundary ahead of
|
|
19
|
+
* and behind the clean circle. @default 0.35
|
|
20
|
+
*/
|
|
21
|
+
spread?: number;
|
|
22
|
+
/** fbm octaves — 1 is a soft blob, 6 is gritty. @default 4 */
|
|
23
|
+
detail?: number;
|
|
24
|
+
/** Hard-edged speckle (the signature) vs a soft dissolve. @default true */
|
|
25
|
+
hard?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* When the reveal fires: on first viewport entry (default) or as soon as
|
|
28
|
+
* the texture has decoded. Falls back to `"load"` without IntersectionObserver.
|
|
29
|
+
* @default "visible"
|
|
30
|
+
*/
|
|
31
|
+
play?: "load" | "visible";
|
|
32
|
+
/** Device-pixel-ratio cap. @default 2 */
|
|
33
|
+
dpr?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function ditherReveal(target: TargetLike, options?: DitherRevealOptions): Destroy;
|
|
36
|
+
//# sourceMappingURL=dither-reveal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dither-reveal.d.ts","sourceRoot":"","sources":["../../src/three/dither-reveal.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAsFD,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAsM3F"}
|