use-scroll-animate 5.5.0 → 5.7.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/CHANGELOG.md +24 -0
- package/dist/components/effects.cjs +736 -0
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +165 -2
- package/dist/components/effects.d.ts +165 -2
- package/dist/components/effects.js +723 -3
- package/dist/components/effects.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/components.md +37 -0
- package/package.json +1 -1
|
@@ -147,6 +147,165 @@ declare function hexRgb(hex: string): [number, number, number];
|
|
|
147
147
|
declare function canvasBackground(el: HTMLElement, fx: EffectContext, spec: GenerativeSpec, o: any): () => void;
|
|
148
148
|
declare const GENERATIVE_FX: EffectDefinition[];
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* 5.6 — sound-reactive effects (Web Audio).
|
|
152
|
+
*
|
|
153
|
+
* - `enableAudio(input)` — start analysing the microphone (`'mic'`), an
|
|
154
|
+
* `<audio>` / `<video>` element (or a selector for one) or a `MediaStream`.
|
|
155
|
+
* Browsers only allow an `AudioContext` to start inside a user gesture, so
|
|
156
|
+
* call it from a click handler (or use `<usa-audio>`, which renders the
|
|
157
|
+
* toggle button for you).
|
|
158
|
+
* - Background effects (kind `background`, Canvas 2D through
|
|
159
|
+
* `canvasBackground()`): `spectrum-bars`, `pulse-ring`, `wave-ring`. Before
|
|
160
|
+
* audio is enabled they idle gently.
|
|
161
|
+
* - Beat detection: `createBeatDetector()` (pure: energy → beat?), `onBeat(cb)`
|
|
162
|
+
* and `bindBeat(el, effect, options)`, which plays any registered effect on
|
|
163
|
+
* every beat. `<usa-audio>` does the same for `[data-usa-beat="effect"]`
|
|
164
|
+
* children and emits `usa-beat`.
|
|
165
|
+
* - While audio runs, `--usa-audio-level` and `--usa-audio-bass` (0–1) are set
|
|
166
|
+
* on `<html>` for CSS-driven reactions.
|
|
167
|
+
*
|
|
168
|
+
* Reduced motion: the visual effects are skipped, beats play no effects and
|
|
169
|
+
* the CSS variables stay at 0 — audio itself keeps playing.
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
type AudioInput = 'mic' | HTMLMediaElement | MediaStream | string;
|
|
173
|
+
interface AudioSample {
|
|
174
|
+
/** Overall loudness (RMS of the waveform), 0–1. */
|
|
175
|
+
level: number;
|
|
176
|
+
/** Low-frequency energy (first ~8 % of the spectrum), 0–1. */
|
|
177
|
+
bass: number;
|
|
178
|
+
/** Frequency bins, 0–255 each. */
|
|
179
|
+
freq: Uint8Array;
|
|
180
|
+
/** Time-domain waveform, 0–255 (128 = silence). */
|
|
181
|
+
wave: Uint8Array;
|
|
182
|
+
}
|
|
183
|
+
interface AudioReactive {
|
|
184
|
+
readonly context: AudioContext;
|
|
185
|
+
readonly analyser: AnalyserNode;
|
|
186
|
+
/** Read the analyser now. */
|
|
187
|
+
sample(): AudioSample;
|
|
188
|
+
/** Stop analysing (media keeps playing; the microphone is released). */
|
|
189
|
+
stop(): void;
|
|
190
|
+
}
|
|
191
|
+
interface BeatOptions {
|
|
192
|
+
/** A beat is energy above `threshold` × the recent average (default 1.35). */
|
|
193
|
+
threshold?: number;
|
|
194
|
+
/** Minimum ms between beats (default 250). */
|
|
195
|
+
cooldown?: number;
|
|
196
|
+
/** Frames of history for the average (default 43 ≈ 0.7 s). */
|
|
197
|
+
history?: number;
|
|
198
|
+
/** Ignore energy below this floor, 0–1 (default 0.08). */
|
|
199
|
+
floor?: number;
|
|
200
|
+
}
|
|
201
|
+
/** The running analyser, if `enableAudio()` was called. */
|
|
202
|
+
declare const getAudio: () => AudioReactive | null;
|
|
203
|
+
/**
|
|
204
|
+
* Start analysing `input` and make it the source of every sound-reactive
|
|
205
|
+
* effect. Call from a user gesture. Replaces a previous source.
|
|
206
|
+
*/
|
|
207
|
+
declare function enableAudio(input?: AudioInput, opts?: {
|
|
208
|
+
fftSize?: number;
|
|
209
|
+
smoothing?: number;
|
|
210
|
+
}): Promise<AudioReactive>;
|
|
211
|
+
/** Stop the current audio source (if any). */
|
|
212
|
+
declare function disableAudio(): void;
|
|
213
|
+
/** A pure beat detector: feed it energy (0–1) and a timestamp per frame; it answers "beat?". */
|
|
214
|
+
declare function createBeatDetector(o?: BeatOptions): (energy: number, now: number) => boolean;
|
|
215
|
+
/** Call `cb` on every detected beat of the current audio source. Returns an unsubscribe. */
|
|
216
|
+
declare function onBeat(cb: (detail: {
|
|
217
|
+
energy: number;
|
|
218
|
+
time: number;
|
|
219
|
+
}) => void, o?: BeatOptions): () => void;
|
|
220
|
+
/** Play the registered effect `name` on `el` at every beat (not under reduced motion). Returns an unbind. */
|
|
221
|
+
declare function bindBeat(el: HTMLElement, name: string, options?: Record<string, unknown> & BeatOptions): () => void;
|
|
222
|
+
declare const AUDIO_FX: EffectDefinition[];
|
|
223
|
+
interface UsaAudioElement extends UsaElement {
|
|
224
|
+
/** `true` while this element's audio source is being analysed. */
|
|
225
|
+
readonly active: boolean;
|
|
226
|
+
/** Start (from a user gesture) or stop analysing. */
|
|
227
|
+
toggle(): Promise<void>;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* `<usa-audio source="#track | mic" label="…">` — a toggle button (yours, as
|
|
231
|
+
* `[data-audio-toggle]`, or one it renders) that enables the audio source on
|
|
232
|
+
* click; children with `data-usa-beat="effect"` play that effect on every
|
|
233
|
+
* beat (`data-usa-beat-options` JSON; `threshold` / `cooldown` attributes).
|
|
234
|
+
* Emits `usa-beat` and `usa-audio-error`.
|
|
235
|
+
*/
|
|
236
|
+
declare function defineAudio(tag?: string): CustomElementConstructor | undefined;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 5.7 — cursor & gesture packs.
|
|
240
|
+
*
|
|
241
|
+
* Cursor effects (kind `cursor`, persistent, scoped to the element they are
|
|
242
|
+
* bound to; skipped under reduced motion and — unless `touch: true` — for
|
|
243
|
+
* touch pointers): `comet-trail`, `sparkle-trail`, `ribbon-trail`,
|
|
244
|
+
* `magnetic-dots`, `spotlight-cursor`.
|
|
245
|
+
*
|
|
246
|
+
* Gestures → effects: `bindGesture(el, 'fling' | 'twist' | 'long-press',
|
|
247
|
+
* effectOrCallback, options)` and `<usa-gesture-fx gesture effect>`. A fling
|
|
248
|
+
* is a fast release, a twist a two-finger rotation past `angle` degrees, a
|
|
249
|
+
* long press "charges" `--usa-charge` 0 → 1 and fires when full. Every fire
|
|
250
|
+
* dispatches `usa-gesture` (`detail: { gesture, … }`). The effect itself goes
|
|
251
|
+
* through `playEffect()`, so reduced motion is honoured there.
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
type Pt = {
|
|
255
|
+
x: number;
|
|
256
|
+
y: number;
|
|
257
|
+
t: number;
|
|
258
|
+
};
|
|
259
|
+
declare const CURSOR_FX: EffectDefinition[];
|
|
260
|
+
declare const GESTURES: readonly ["fling", "twist", "long-press"];
|
|
261
|
+
type GestureName = (typeof GESTURES)[number];
|
|
262
|
+
interface GestureFxOptions {
|
|
263
|
+
/** fling: minimum release speed in px/ms (default 0.8). */
|
|
264
|
+
velocity?: number;
|
|
265
|
+
/** twist: degrees of rotation that fire (default 30). */
|
|
266
|
+
angle?: number;
|
|
267
|
+
/** long-press: ms to fully charge (default 650). */
|
|
268
|
+
duration?: number;
|
|
269
|
+
/** long-press: px the pointer may move before the press is cancelled (default 10). */
|
|
270
|
+
tolerance?: number;
|
|
271
|
+
/** Options passed to the effect. */
|
|
272
|
+
effectOptions?: Record<string, unknown>;
|
|
273
|
+
}
|
|
274
|
+
interface GestureDetail {
|
|
275
|
+
gesture: GestureName;
|
|
276
|
+
/** fling */
|
|
277
|
+
vx?: number;
|
|
278
|
+
vy?: number;
|
|
279
|
+
speed?: number;
|
|
280
|
+
direction?: 'left' | 'right' | 'up' | 'down' | 'cw' | 'ccw';
|
|
281
|
+
/** twist: signed degrees since the last fire. */
|
|
282
|
+
angle?: number;
|
|
283
|
+
/** long-press: 1 when fired. */
|
|
284
|
+
charge?: number;
|
|
285
|
+
}
|
|
286
|
+
/** Release velocity (px/ms) from recent pointer samples: uses the last `window` ms (pure). */
|
|
287
|
+
declare function flingVelocity(pts: Pt[], window?: number): {
|
|
288
|
+
vx: number;
|
|
289
|
+
vy: number;
|
|
290
|
+
speed: number;
|
|
291
|
+
};
|
|
292
|
+
/** Signed smallest difference between two angles in degrees, in (-180, 180] (pure). */
|
|
293
|
+
declare function angleDelta(a: number, b: number): number;
|
|
294
|
+
/**
|
|
295
|
+
* Fire `effect` (a registered effect name, or a callback) when `gesture`
|
|
296
|
+
* happens on `el`. Returns an unbind.
|
|
297
|
+
*/
|
|
298
|
+
declare function bindGesture(el: HTMLElement, gesture: GestureName, effect: string | ((d: GestureDetail, e: Event) => void), o?: GestureFxOptions): () => void;
|
|
299
|
+
interface UsaGestureFxElement extends UsaElement {
|
|
300
|
+
readonly gesture: GestureName;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* `<usa-gesture-fx gesture="fling | twist | long-press" effect="tada"
|
|
304
|
+
* options='{"…"}' velocity angle duration>` — plays `effect` on its first
|
|
305
|
+
* child (or itself with `self`) when the gesture happens.
|
|
306
|
+
*/
|
|
307
|
+
declare function defineGestureFx(tag?: string): CustomElementConstructor | undefined;
|
|
308
|
+
|
|
150
309
|
/**
|
|
151
310
|
* 5.4 — `<usa-story template="…">` scroll-storytelling templates.
|
|
152
311
|
*
|
|
@@ -199,10 +358,14 @@ declare function registerPhysicsEffects(): void;
|
|
|
199
358
|
declare function registerPageEffects(): void;
|
|
200
359
|
/** 5.5: generative Canvas 2D backgrounds. */
|
|
201
360
|
declare function registerGenerativeEffects(): void;
|
|
361
|
+
/** 5.6: sound-reactive (Web Audio) backgrounds. */
|
|
362
|
+
declare function registerAudioEffects(): void;
|
|
363
|
+
/** 5.7: cursor trails, magnetic dots, spotlight cursor. */
|
|
364
|
+
declare function registerCursorEffects(): void;
|
|
202
365
|
/** Define the 5.x elements of this entry (`<usa-story>`, …) under their default tags. */
|
|
203
366
|
declare function defineEffectElements(): void;
|
|
204
367
|
/** Register the built-ins and every pack (idempotent). */
|
|
205
368
|
declare function registerAllEffects(): void;
|
|
206
369
|
|
|
207
|
-
export { CARD_FX, CLICK_FX, EFFECT_PACKS, GENERATIVE_FX, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, bounceKeyframes, canvasBackground, defineEffectElements, defineStory, formatCount, fxLayer, hexRgb, noise2, registerAllEffects, registerCardClickEffects, registerGenerativeEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress };
|
|
208
|
-
export type { GenFrame, GenerativeSpec, SpringOptions, StoryTemplate, UsaStoryElement };
|
|
370
|
+
export { AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, angleDelta, bindBeat, bindGesture, bounceKeyframes, canvasBackground, createBeatDetector, defineAudio, defineEffectElements, defineGestureFx, defineStory, disableAudio, enableAudio, flingVelocity, formatCount, fxLayer, getAudio, hexRgb, noise2, onBeat, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress };
|
|
371
|
+
export type { AudioInput, AudioReactive, AudioSample, BeatOptions, GenFrame, GenerativeSpec, GestureDetail, GestureFxOptions, GestureName, SpringOptions, StoryTemplate, UsaAudioElement, UsaGestureFxElement, UsaStoryElement };
|
|
@@ -147,6 +147,165 @@ declare function hexRgb(hex: string): [number, number, number];
|
|
|
147
147
|
declare function canvasBackground(el: HTMLElement, fx: EffectContext, spec: GenerativeSpec, o: any): () => void;
|
|
148
148
|
declare const GENERATIVE_FX: EffectDefinition[];
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* 5.6 — sound-reactive effects (Web Audio).
|
|
152
|
+
*
|
|
153
|
+
* - `enableAudio(input)` — start analysing the microphone (`'mic'`), an
|
|
154
|
+
* `<audio>` / `<video>` element (or a selector for one) or a `MediaStream`.
|
|
155
|
+
* Browsers only allow an `AudioContext` to start inside a user gesture, so
|
|
156
|
+
* call it from a click handler (or use `<usa-audio>`, which renders the
|
|
157
|
+
* toggle button for you).
|
|
158
|
+
* - Background effects (kind `background`, Canvas 2D through
|
|
159
|
+
* `canvasBackground()`): `spectrum-bars`, `pulse-ring`, `wave-ring`. Before
|
|
160
|
+
* audio is enabled they idle gently.
|
|
161
|
+
* - Beat detection: `createBeatDetector()` (pure: energy → beat?), `onBeat(cb)`
|
|
162
|
+
* and `bindBeat(el, effect, options)`, which plays any registered effect on
|
|
163
|
+
* every beat. `<usa-audio>` does the same for `[data-usa-beat="effect"]`
|
|
164
|
+
* children and emits `usa-beat`.
|
|
165
|
+
* - While audio runs, `--usa-audio-level` and `--usa-audio-bass` (0–1) are set
|
|
166
|
+
* on `<html>` for CSS-driven reactions.
|
|
167
|
+
*
|
|
168
|
+
* Reduced motion: the visual effects are skipped, beats play no effects and
|
|
169
|
+
* the CSS variables stay at 0 — audio itself keeps playing.
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
type AudioInput = 'mic' | HTMLMediaElement | MediaStream | string;
|
|
173
|
+
interface AudioSample {
|
|
174
|
+
/** Overall loudness (RMS of the waveform), 0–1. */
|
|
175
|
+
level: number;
|
|
176
|
+
/** Low-frequency energy (first ~8 % of the spectrum), 0–1. */
|
|
177
|
+
bass: number;
|
|
178
|
+
/** Frequency bins, 0–255 each. */
|
|
179
|
+
freq: Uint8Array;
|
|
180
|
+
/** Time-domain waveform, 0–255 (128 = silence). */
|
|
181
|
+
wave: Uint8Array;
|
|
182
|
+
}
|
|
183
|
+
interface AudioReactive {
|
|
184
|
+
readonly context: AudioContext;
|
|
185
|
+
readonly analyser: AnalyserNode;
|
|
186
|
+
/** Read the analyser now. */
|
|
187
|
+
sample(): AudioSample;
|
|
188
|
+
/** Stop analysing (media keeps playing; the microphone is released). */
|
|
189
|
+
stop(): void;
|
|
190
|
+
}
|
|
191
|
+
interface BeatOptions {
|
|
192
|
+
/** A beat is energy above `threshold` × the recent average (default 1.35). */
|
|
193
|
+
threshold?: number;
|
|
194
|
+
/** Minimum ms between beats (default 250). */
|
|
195
|
+
cooldown?: number;
|
|
196
|
+
/** Frames of history for the average (default 43 ≈ 0.7 s). */
|
|
197
|
+
history?: number;
|
|
198
|
+
/** Ignore energy below this floor, 0–1 (default 0.08). */
|
|
199
|
+
floor?: number;
|
|
200
|
+
}
|
|
201
|
+
/** The running analyser, if `enableAudio()` was called. */
|
|
202
|
+
declare const getAudio: () => AudioReactive | null;
|
|
203
|
+
/**
|
|
204
|
+
* Start analysing `input` and make it the source of every sound-reactive
|
|
205
|
+
* effect. Call from a user gesture. Replaces a previous source.
|
|
206
|
+
*/
|
|
207
|
+
declare function enableAudio(input?: AudioInput, opts?: {
|
|
208
|
+
fftSize?: number;
|
|
209
|
+
smoothing?: number;
|
|
210
|
+
}): Promise<AudioReactive>;
|
|
211
|
+
/** Stop the current audio source (if any). */
|
|
212
|
+
declare function disableAudio(): void;
|
|
213
|
+
/** A pure beat detector: feed it energy (0–1) and a timestamp per frame; it answers "beat?". */
|
|
214
|
+
declare function createBeatDetector(o?: BeatOptions): (energy: number, now: number) => boolean;
|
|
215
|
+
/** Call `cb` on every detected beat of the current audio source. Returns an unsubscribe. */
|
|
216
|
+
declare function onBeat(cb: (detail: {
|
|
217
|
+
energy: number;
|
|
218
|
+
time: number;
|
|
219
|
+
}) => void, o?: BeatOptions): () => void;
|
|
220
|
+
/** Play the registered effect `name` on `el` at every beat (not under reduced motion). Returns an unbind. */
|
|
221
|
+
declare function bindBeat(el: HTMLElement, name: string, options?: Record<string, unknown> & BeatOptions): () => void;
|
|
222
|
+
declare const AUDIO_FX: EffectDefinition[];
|
|
223
|
+
interface UsaAudioElement extends UsaElement {
|
|
224
|
+
/** `true` while this element's audio source is being analysed. */
|
|
225
|
+
readonly active: boolean;
|
|
226
|
+
/** Start (from a user gesture) or stop analysing. */
|
|
227
|
+
toggle(): Promise<void>;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* `<usa-audio source="#track | mic" label="…">` — a toggle button (yours, as
|
|
231
|
+
* `[data-audio-toggle]`, or one it renders) that enables the audio source on
|
|
232
|
+
* click; children with `data-usa-beat="effect"` play that effect on every
|
|
233
|
+
* beat (`data-usa-beat-options` JSON; `threshold` / `cooldown` attributes).
|
|
234
|
+
* Emits `usa-beat` and `usa-audio-error`.
|
|
235
|
+
*/
|
|
236
|
+
declare function defineAudio(tag?: string): CustomElementConstructor | undefined;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 5.7 — cursor & gesture packs.
|
|
240
|
+
*
|
|
241
|
+
* Cursor effects (kind `cursor`, persistent, scoped to the element they are
|
|
242
|
+
* bound to; skipped under reduced motion and — unless `touch: true` — for
|
|
243
|
+
* touch pointers): `comet-trail`, `sparkle-trail`, `ribbon-trail`,
|
|
244
|
+
* `magnetic-dots`, `spotlight-cursor`.
|
|
245
|
+
*
|
|
246
|
+
* Gestures → effects: `bindGesture(el, 'fling' | 'twist' | 'long-press',
|
|
247
|
+
* effectOrCallback, options)` and `<usa-gesture-fx gesture effect>`. A fling
|
|
248
|
+
* is a fast release, a twist a two-finger rotation past `angle` degrees, a
|
|
249
|
+
* long press "charges" `--usa-charge` 0 → 1 and fires when full. Every fire
|
|
250
|
+
* dispatches `usa-gesture` (`detail: { gesture, … }`). The effect itself goes
|
|
251
|
+
* through `playEffect()`, so reduced motion is honoured there.
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
type Pt = {
|
|
255
|
+
x: number;
|
|
256
|
+
y: number;
|
|
257
|
+
t: number;
|
|
258
|
+
};
|
|
259
|
+
declare const CURSOR_FX: EffectDefinition[];
|
|
260
|
+
declare const GESTURES: readonly ["fling", "twist", "long-press"];
|
|
261
|
+
type GestureName = (typeof GESTURES)[number];
|
|
262
|
+
interface GestureFxOptions {
|
|
263
|
+
/** fling: minimum release speed in px/ms (default 0.8). */
|
|
264
|
+
velocity?: number;
|
|
265
|
+
/** twist: degrees of rotation that fire (default 30). */
|
|
266
|
+
angle?: number;
|
|
267
|
+
/** long-press: ms to fully charge (default 650). */
|
|
268
|
+
duration?: number;
|
|
269
|
+
/** long-press: px the pointer may move before the press is cancelled (default 10). */
|
|
270
|
+
tolerance?: number;
|
|
271
|
+
/** Options passed to the effect. */
|
|
272
|
+
effectOptions?: Record<string, unknown>;
|
|
273
|
+
}
|
|
274
|
+
interface GestureDetail {
|
|
275
|
+
gesture: GestureName;
|
|
276
|
+
/** fling */
|
|
277
|
+
vx?: number;
|
|
278
|
+
vy?: number;
|
|
279
|
+
speed?: number;
|
|
280
|
+
direction?: 'left' | 'right' | 'up' | 'down' | 'cw' | 'ccw';
|
|
281
|
+
/** twist: signed degrees since the last fire. */
|
|
282
|
+
angle?: number;
|
|
283
|
+
/** long-press: 1 when fired. */
|
|
284
|
+
charge?: number;
|
|
285
|
+
}
|
|
286
|
+
/** Release velocity (px/ms) from recent pointer samples: uses the last `window` ms (pure). */
|
|
287
|
+
declare function flingVelocity(pts: Pt[], window?: number): {
|
|
288
|
+
vx: number;
|
|
289
|
+
vy: number;
|
|
290
|
+
speed: number;
|
|
291
|
+
};
|
|
292
|
+
/** Signed smallest difference between two angles in degrees, in (-180, 180] (pure). */
|
|
293
|
+
declare function angleDelta(a: number, b: number): number;
|
|
294
|
+
/**
|
|
295
|
+
* Fire `effect` (a registered effect name, or a callback) when `gesture`
|
|
296
|
+
* happens on `el`. Returns an unbind.
|
|
297
|
+
*/
|
|
298
|
+
declare function bindGesture(el: HTMLElement, gesture: GestureName, effect: string | ((d: GestureDetail, e: Event) => void), o?: GestureFxOptions): () => void;
|
|
299
|
+
interface UsaGestureFxElement extends UsaElement {
|
|
300
|
+
readonly gesture: GestureName;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* `<usa-gesture-fx gesture="fling | twist | long-press" effect="tada"
|
|
304
|
+
* options='{"…"}' velocity angle duration>` — plays `effect` on its first
|
|
305
|
+
* child (or itself with `self`) when the gesture happens.
|
|
306
|
+
*/
|
|
307
|
+
declare function defineGestureFx(tag?: string): CustomElementConstructor | undefined;
|
|
308
|
+
|
|
150
309
|
/**
|
|
151
310
|
* 5.4 — `<usa-story template="…">` scroll-storytelling templates.
|
|
152
311
|
*
|
|
@@ -199,10 +358,14 @@ declare function registerPhysicsEffects(): void;
|
|
|
199
358
|
declare function registerPageEffects(): void;
|
|
200
359
|
/** 5.5: generative Canvas 2D backgrounds. */
|
|
201
360
|
declare function registerGenerativeEffects(): void;
|
|
361
|
+
/** 5.6: sound-reactive (Web Audio) backgrounds. */
|
|
362
|
+
declare function registerAudioEffects(): void;
|
|
363
|
+
/** 5.7: cursor trails, magnetic dots, spotlight cursor. */
|
|
364
|
+
declare function registerCursorEffects(): void;
|
|
202
365
|
/** Define the 5.x elements of this entry (`<usa-story>`, …) under their default tags. */
|
|
203
366
|
declare function defineEffectElements(): void;
|
|
204
367
|
/** Register the built-ins and every pack (idempotent). */
|
|
205
368
|
declare function registerAllEffects(): void;
|
|
206
369
|
|
|
207
|
-
export { CARD_FX, CLICK_FX, EFFECT_PACKS, GENERATIVE_FX, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, bounceKeyframes, canvasBackground, defineEffectElements, defineStory, formatCount, fxLayer, hexRgb, noise2, registerAllEffects, registerCardClickEffects, registerGenerativeEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress };
|
|
208
|
-
export type { GenFrame, GenerativeSpec, SpringOptions, StoryTemplate, UsaStoryElement };
|
|
370
|
+
export { AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, angleDelta, bindBeat, bindGesture, bounceKeyframes, canvasBackground, createBeatDetector, defineAudio, defineEffectElements, defineGestureFx, defineStory, disableAudio, enableAudio, flingVelocity, formatCount, fxLayer, getAudio, hexRgb, noise2, onBeat, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress };
|
|
371
|
+
export type { AudioInput, AudioReactive, AudioSample, BeatOptions, GenFrame, GenerativeSpec, GestureDetail, GestureFxOptions, GestureName, SpringOptions, StoryTemplate, UsaAudioElement, UsaGestureFxElement, UsaStoryElement };
|