pixi-effects 0.10.0 → 0.12.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 +37 -0
- package/README.md +11 -8
- package/ai/SKILL.md +4 -3
- package/ai/reference/cheatsheet.md +16 -2
- package/ai/reference/pitfalls.md +6 -2
- package/ai/reference/recipes.md +76 -10
- package/ai/template.html +15 -8
- package/ai/tools/check.mjs +17 -1
- package/ai/tools/render.mjs +23 -10
- package/dist/{Base-CyvSLoCP.d.ts → Base-CYH9vPCH.d.ts} +1 -1
- package/dist/{Base-CwUxTfja.d.cts → Base-W3sQzGPO.d.cts} +1 -1
- package/dist/Composition-7TEKHZNQ.cjs +14 -0
- package/dist/{Composition-EKVTUYCI.cjs.map → Composition-7TEKHZNQ.cjs.map} +1 -1
- package/dist/Composition-HIISJAX2.js +5 -0
- package/dist/{Composition-NJCOMGD7.js.map → Composition-HIISJAX2.js.map} +1 -1
- package/dist/Controller.cjs +58 -0
- package/dist/Controller.cjs.map +1 -1
- package/dist/Controller.d.cts +13 -3
- package/dist/Controller.d.ts +13 -3
- package/dist/Controller.js +58 -0
- package/dist/Controller.js.map +1 -1
- package/dist/{Movie-w3GliuP3.d.cts → Movie-CY2QPVVM.d.cts} +149 -2
- package/dist/{Movie-puD9oZPg.d.ts → Movie-EBF6_RfX.d.ts} +149 -2
- package/dist/Presenter.cjs +671 -0
- package/dist/Presenter.cjs.map +1 -0
- package/dist/Presenter.d.cts +123 -0
- package/dist/Presenter.d.ts +123 -0
- package/dist/Presenter.js +669 -0
- package/dist/Presenter.js.map +1 -0
- package/dist/{chunk-WDGAVOMS.js → chunk-3IPDNC3E.js} +8 -5
- package/dist/chunk-3IPDNC3E.js.map +1 -0
- package/dist/{chunk-S3ZI4MKS.cjs → chunk-6NWJLVCA.cjs} +3 -3
- package/dist/{chunk-S3ZI4MKS.cjs.map → chunk-6NWJLVCA.cjs.map} +1 -1
- package/dist/{chunk-JAMNDBXW.js → chunk-C6QHKYC5.js} +3 -3
- package/dist/{chunk-JAMNDBXW.js.map → chunk-C6QHKYC5.js.map} +1 -1
- package/dist/{chunk-4WJUSDJJ.cjs → chunk-F7NCHS6Q.cjs} +31 -28
- package/dist/chunk-F7NCHS6Q.cjs.map +1 -0
- package/dist/index.cjs +884 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +234 -5
- package/dist/index.d.ts +234 -5
- package/dist/index.js +856 -40
- package/dist/index.js.map +1 -1
- package/dist/loader.css +110 -0
- package/dist/three.cjs +5 -5
- package/dist/three.d.cts +2 -2
- package/dist/three.d.ts +2 -2
- package/dist/three.js +1 -1
- package/dist/{types-BXu28nJj.d.cts → types-mpqQO8MJ.d.cts} +39 -1
- package/dist/{types-BXu28nJj.d.ts → types-mpqQO8MJ.d.ts} +39 -1
- package/docs/api.md +94 -1
- package/docs/dsl.md +77 -0
- package/llms-full.txt +273 -18
- package/llms.txt +3 -3
- package/package.json +9 -2
- package/dist/Composition-EKVTUYCI.cjs +0 -14
- package/dist/Composition-NJCOMGD7.js +0 -5
- package/dist/chunk-4WJUSDJJ.cjs.map +0 -1
- package/dist/chunk-WDGAVOMS.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, M as Movie,
|
|
2
|
-
import { S as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, d as LoaderOption, M as MotionBlurOptions, e as MotionBlurSpec, f as Movie, g as MovieErrorEvent, h as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, i as SoundMeasure, j as StopEvent, k as StopImage, l as StopImagesOptions, T as TimelineData, m as TimelineHtmlOptions, n as TimelineRow, o as TimelineSvgOptions, p as TimelineTransition, V as VolumeEvent, q as dismissLoader, r as failLoader, s as resolveLoader } from './Movie-CY2QPVVM.cjs';
|
|
2
|
+
import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-mpqQO8MJ.cjs';
|
|
3
|
+
export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioSequenceSpec, h as AudioSfxSpec, i as ChromaKeyFilterSpec, j as CircleShapeSpec, k as CompositionSequenceSpec, l as CrossfadeTransition, m as CustomFilterSpec, D as DipTransition, n as DissolveTransition, E as EllipseShapeSpec, o as Expr, F as FilterSpec, G as GradientSpec, p as IrisTransition, L as LineShapeSpec, N as NullSequenceSpec, q as PathShapeSpec, r as PolygonShapeSpec, s as PropValue, R as RectShapeSpec, t as SfxKnobs, u as SfxOptions, v as SfxPreset, w as SfxVoice, x as ShapeSequenceSpec, y as SlideTransition, z as Stop, B as StopSpec, H as TransitionCommon, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition, J as normalizeStops } from './types-mpqQO8MJ.cjs';
|
|
4
|
+
import { S as Sequence } from './Base-W3sQzGPO.cjs';
|
|
5
5
|
import 'pixi.js';
|
|
6
6
|
import 'gsap';
|
|
7
7
|
|
|
@@ -162,6 +162,78 @@ interface OrbitOptions {
|
|
|
162
162
|
*/
|
|
163
163
|
declare function orbit(opts: OrbitOptions): CameraSequenceSpec;
|
|
164
164
|
|
|
165
|
+
type Range = number | [number, number];
|
|
166
|
+
interface ParticlesOptions {
|
|
167
|
+
/** How many particles. Required. */
|
|
168
|
+
count: number;
|
|
169
|
+
/** When the first one can be born, in composition seconds. Default 0. */
|
|
170
|
+
at?: number;
|
|
171
|
+
/** Births are spread over this many seconds (0, the default, is a burst: all at once). */
|
|
172
|
+
emit?: number;
|
|
173
|
+
/** How long each lives, in seconds: a number or `[min, max]`. Required. */
|
|
174
|
+
life: Range;
|
|
175
|
+
/** Where they start: the centre `x`, `y`, and optionally a `width` / `height` to spread over (snow: `{ x: 640, y: -20, width: 1280 }`). Required. */
|
|
176
|
+
area: {
|
|
177
|
+
x: number;
|
|
178
|
+
y: number;
|
|
179
|
+
width?: number;
|
|
180
|
+
height?: number;
|
|
181
|
+
};
|
|
182
|
+
/** Direction of the launch, degrees: 0 is right, 90 down, −90 up. A number or `[min, max]`. Default `[0, 360]`. */
|
|
183
|
+
angle?: Range;
|
|
184
|
+
/** Launch speed in px per second. Default `[100, 300]`. */
|
|
185
|
+
speed?: Range;
|
|
186
|
+
/** Acceleration down, px/s² (negative floats up). Default 0. */
|
|
187
|
+
gravity?: number;
|
|
188
|
+
/** Acceleration sideways, px/s². Default 0. */
|
|
189
|
+
wind?: number;
|
|
190
|
+
/** Air drag per second: they slow toward a terminal speed. Default 0. */
|
|
191
|
+
drag?: number;
|
|
192
|
+
/** A smooth side-to-side wobble: up to about ±`amp` px, `freq` wobbles per second (default 1). Snow, leaves, embers. */
|
|
193
|
+
sway?: {
|
|
194
|
+
amp: number;
|
|
195
|
+
freq?: number;
|
|
196
|
+
};
|
|
197
|
+
/** Radius in px (a square's half-side): a number or `[min, max]`. Default `[3, 6]`. */
|
|
198
|
+
size?: Range;
|
|
199
|
+
/** Scale over the life, `[start, end]` (`[1, 0]` shrinks away). Default none. */
|
|
200
|
+
scale?: [number, number];
|
|
201
|
+
/** Alpha ramps in seconds: `in` from transparent at birth, `out` back to transparent at the end of the life. */
|
|
202
|
+
fade?: {
|
|
203
|
+
in?: number;
|
|
204
|
+
out?: number;
|
|
205
|
+
};
|
|
206
|
+
/** Fill colours, picked at random for each particle. Default white. */
|
|
207
|
+
colors?: string[];
|
|
208
|
+
/** `'circle'` (default), `'rect'` (a square) or `'star'`. */
|
|
209
|
+
shape?: 'circle' | 'rect' | 'star';
|
|
210
|
+
/** Turning speed in degrees per second (a number or `[min, max]`; they also start at a random angle). Default none. */
|
|
211
|
+
spin?: Range;
|
|
212
|
+
/** Another seed is another burst. Default 0. */
|
|
213
|
+
seed?: number;
|
|
214
|
+
/** Layers are named `<name>-0`, `<name>-1`, … (default `'particle'`). */
|
|
215
|
+
name?: string;
|
|
216
|
+
/** `'add'` makes overlapping particles glow. */
|
|
217
|
+
blendMode?: string;
|
|
218
|
+
/** Use this layer (any type: an image, a text) for every particle instead of a shape; its keyframes are kept. */
|
|
219
|
+
template?: SequenceSpec;
|
|
220
|
+
/** Samples per second of a curved path (gravity, wind, drag, sway): straight steps between them. Default 20. */
|
|
221
|
+
sampleRate?: number;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Particles as plain layers: a burst, a fountain, snow, confetti, sparks. Each one is a layer with its own seeded start,
|
|
225
|
+
* velocity, size, colour and life, and a path baked into keyframes (so playback, seeking and export agree), living only
|
|
226
|
+
* while it is alive. Spread the result into `sequences`.
|
|
227
|
+
*
|
|
228
|
+
* ```js
|
|
229
|
+
* ...particles({ count: 80, at: 2, life: [0.8, 1.6], area: { x: 640, y: 400 }, speed: [150, 450], gravity: 500,
|
|
230
|
+
* size: [3, 7], colors: ['#ffd166', '#ff6b9d', '#4cc9f0'], fade: { out: 0.4 }, blendMode: 'add' })
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* A particle with no gravity, wind, drag or sway is one straight tween; a curved path is sampled `sampleRate` times a second.
|
|
234
|
+
*/
|
|
235
|
+
declare function particles(opts: ParticlesOptions): SequenceSpec[];
|
|
236
|
+
|
|
165
237
|
interface FollowPathOptions {
|
|
166
238
|
/** The route, as SVG path data in the same canvas coordinates the layer's `x` / `y` use. Several sub-paths are walked in order. */
|
|
167
239
|
d: string;
|
|
@@ -345,6 +417,163 @@ interface AnimateTextOptions {
|
|
|
345
417
|
*/
|
|
346
418
|
declare function animateText(text: string, style: MeasureStyle, options: AnimateTextOptions): TextSequenceSpec[];
|
|
347
419
|
|
|
420
|
+
/** The part of an `AudioBuffer` the analysis reads (so it can be tested with plain arrays). */
|
|
421
|
+
interface AudioLike {
|
|
422
|
+
sampleRate: number;
|
|
423
|
+
numberOfChannels: number;
|
|
424
|
+
length: number;
|
|
425
|
+
getChannelData(channel: number): Float32Array;
|
|
426
|
+
}
|
|
427
|
+
interface EnvelopeOptions {
|
|
428
|
+
/** One value per video frame: use your movie's `frameRate`. Default 30. */
|
|
429
|
+
frameRate?: number;
|
|
430
|
+
/** Frequency bands in Hz, `{ name: [from, to] }`. Default `{ bass: [20, 150], mid: [150, 2000], treble: [2000, 10000] }`. */
|
|
431
|
+
bands?: Record<string, [number, number]>;
|
|
432
|
+
/** The band the beats are looked for in (default `'bass'`, or `'level'` if there is no such band). */
|
|
433
|
+
beatBand?: string;
|
|
434
|
+
/** More (above 1) or fewer (below 1) beats. Default 1. */
|
|
435
|
+
beatSensitivity?: number;
|
|
436
|
+
}
|
|
437
|
+
/** What a piece of sound does over time, as numbers between 0 and 1, one per video frame, plus where its beats are. */
|
|
438
|
+
interface AudioEnvelope {
|
|
439
|
+
frameRate: number;
|
|
440
|
+
/** Seconds of sound. */
|
|
441
|
+
duration: number;
|
|
442
|
+
/** Values per series (`frames`). */
|
|
443
|
+
frames: number;
|
|
444
|
+
/** `level` (the overall loudness) and one series per band, each 0–1 on a log (perceptual) scale. */
|
|
445
|
+
series: Record<string, Float32Array>;
|
|
446
|
+
/** Times of the beats, in seconds. */
|
|
447
|
+
beats: number[];
|
|
448
|
+
/** The tempo estimated from the beats (null if there are too few). */
|
|
449
|
+
bpm: number | null;
|
|
450
|
+
/** The value of a series at a time (seconds): interpolated between frames, held at the ends. `series` defaults to `'level'`. */
|
|
451
|
+
at(time: number, series?: string): number;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Analyse a sound: its loudness and the energy in a few frequency bands, one value per video frame (0–1 on a log scale, all measured
|
|
455
|
+
* against the loudest of them, so the balance between bands is kept and a quiet file looks like a loud one), and where its beats are.
|
|
456
|
+
* Pure and deterministic: the same sound gives the same numbers.
|
|
457
|
+
*/
|
|
458
|
+
declare function computeEnvelope(audio: AudioLike, options?: EnvelopeOptions): AudioEnvelope;
|
|
459
|
+
/**
|
|
460
|
+
* A stand-in for analysed music, on a tempo you choose: a kick on every beat (`bass`), a snare on 2 and 4 (`mid`), hats on the eighth
|
|
461
|
+
* notes (`treble`), each a pulse that decays; `level` follows them. Beats are exactly on the beat. Use it with no audio file, or to
|
|
462
|
+
* make visuals that match sound effects you place on the same tempo.
|
|
463
|
+
*/
|
|
464
|
+
declare function bpmEnvelope(bpm: number, options: {
|
|
465
|
+
duration: number;
|
|
466
|
+
frameRate?: number;
|
|
467
|
+
swing?: number;
|
|
468
|
+
}): AudioEnvelope;
|
|
469
|
+
/** What `audioEnvelope()` can read: a URL (string), a Blob / File, the raw bytes of a file, or an `AudioBuffer` you already decoded. */
|
|
470
|
+
type AudioEnvelopeSource = string | URL | Blob | ArrayBuffer | AudioBuffer;
|
|
471
|
+
/**
|
|
472
|
+
* Decode an audio file and analyse it (see {@link computeEnvelope}). Do it before `movie.init`, with the same file the music layer plays,
|
|
473
|
+
* and feed the result to `react()`:
|
|
474
|
+
*
|
|
475
|
+
* ```js
|
|
476
|
+
* const env = await audioEnvelope('music.mp3', { frameRate: 30 });
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
declare function audioEnvelope(source: AudioEnvelopeSource, options?: EnvelopeOptions): Promise<AudioEnvelope>;
|
|
480
|
+
|
|
481
|
+
interface ReactProp {
|
|
482
|
+
/** The value at rest (a level of 0). Default 0. */
|
|
483
|
+
base?: number;
|
|
484
|
+
/** How far the value goes at a level of 1 (can be negative). Required. */
|
|
485
|
+
amount: number;
|
|
486
|
+
/** Which series of the envelope drives it: `'level'` (default) or a band (`'bass'`, `'mid'`, `'treble'`, or your own). */
|
|
487
|
+
band?: string;
|
|
488
|
+
/** Follow the beats instead: a jump to full on each beat, falling off after it (see `decay`). */
|
|
489
|
+
beats?: boolean;
|
|
490
|
+
/** With `beats`: seconds for the pulse to fall to 37 %. Default 0.2. */
|
|
491
|
+
decay?: number;
|
|
492
|
+
/** Smoothing, in seconds, for a level that rises (`attack`) and falls (`release`), like a level meter: a quick rise and a slow fall looks like a bounce. Default none. */
|
|
493
|
+
attack?: number;
|
|
494
|
+
release?: number;
|
|
495
|
+
/** Use 1 − level (it gets smaller as the sound gets louder). */
|
|
496
|
+
invert?: boolean;
|
|
497
|
+
/** Raise the level to this power first: above 1 only the loud parts move it (a punchier look), below 1 even the quiet ones do. Default 1. */
|
|
498
|
+
curve?: number;
|
|
499
|
+
}
|
|
500
|
+
interface ReactOptions {
|
|
501
|
+
/** Start, in seconds from the start of the layer. Default 0. */
|
|
502
|
+
at?: number;
|
|
503
|
+
/** How long it follows the sound, in seconds. Required. */
|
|
504
|
+
duration: number;
|
|
505
|
+
/** The properties to move and how, each its own way: `{ scale: { base: 1, amount: 0.3, band: 'bass' }, alpha: { base: 0.3, amount: 0.7 } }`. */
|
|
506
|
+
props: Record<string, ReactProp>;
|
|
507
|
+
/** Where in the sound the layer's start is, in seconds (the layer starts 2 s after the music began: `audioOffset: 2`). Default 0. */
|
|
508
|
+
audioOffset?: number;
|
|
509
|
+
/** The sound repeats (a looping music layer) instead of the last value being held. */
|
|
510
|
+
loop?: boolean;
|
|
511
|
+
/** Samples per second (default: the envelope's, so one per video frame). Lower it for a long layer, the steps get longer. */
|
|
512
|
+
frameRate?: number;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Keyframes that follow a sound: `base + amount × level` sampled once per frame from an envelope (`audioEnvelope()` for a real file,
|
|
516
|
+
* `bpmEnvelope()` for a tempo), so playback, seeking and export all agree. Put the result in a layer's `keyframes`.
|
|
517
|
+
*
|
|
518
|
+
* ```js
|
|
519
|
+
* const env = await audioEnvelope('music.mp3', { frameRate: 30 });
|
|
520
|
+
* { type: 'shape', shape: 'circle', radius: 120, initial: { x: 640, y: 360 },
|
|
521
|
+
* keyframes: react(env, { duration: 12, props: { scale: { base: 1, amount: 0.4, band: 'bass', attack: 0.02, release: 0.2 } } }) }
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
declare function react(env: AudioEnvelope, options: ReactOptions): Keyframe[];
|
|
525
|
+
|
|
526
|
+
interface DeckPage {
|
|
527
|
+
/** The page's name: shown by the Presenter, and in the stops list. */
|
|
528
|
+
name?: string;
|
|
529
|
+
/** How long the page lasts, seconds (including any transition into the next page, see `DeckOptions.transition`). Required. */
|
|
530
|
+
duration: number;
|
|
531
|
+
/** The page's layers, written in the page's own time (`at: 0` is the start of the page). */
|
|
532
|
+
sequences: SequenceSpec[];
|
|
533
|
+
/** Where the page stops, in the page's own time: the first is the page settled, the rest are steps (a bullet appears, a chart grows). Default: where the transition into the next page begins (the end for the last page). */
|
|
534
|
+
stops?: number[];
|
|
535
|
+
/** Speaker notes (kept on the page's first stop). */
|
|
536
|
+
notes?: string;
|
|
537
|
+
/** Move on by itself this many seconds after the page's last stop (kiosk mode). */
|
|
538
|
+
advance?: number;
|
|
539
|
+
/** The page is itself a layer: it may carry `initial`, `keyframes`, `filters`, … (fade or slide the whole page, for instance). */
|
|
540
|
+
initial?: Props;
|
|
541
|
+
keyframes?: Keyframe[];
|
|
542
|
+
}
|
|
543
|
+
/** A transition spec without the parts `deck()` fills in (which two pages, and when). */
|
|
544
|
+
type DeckTransition = TransitionSpec extends infer T ? (T extends TransitionSpec ? Omit<T, 'from' | 'to' | 'at'> : never) : never;
|
|
545
|
+
interface DeckOptions {
|
|
546
|
+
pages: DeckPage[];
|
|
547
|
+
/**
|
|
548
|
+
* A transition between every two pages: `{ kind: 'crossfade' | 'slide' | 'wipe' | 'iris' | 'dip' | 'zoom' | 'dissolve', duration, …its own options }` (see Transitions). The next page starts
|
|
549
|
+
* `duration` seconds before the current one ends, and the transition plays across the overlap.
|
|
550
|
+
*/
|
|
551
|
+
transition?: DeckTransition;
|
|
552
|
+
}
|
|
553
|
+
/** What `deck()` returns: spread it into `movie.init` (`{ duration, composition: { sequences, transitions?, stops } }` plus any movie option you passed). */
|
|
554
|
+
interface DeckResult {
|
|
555
|
+
duration: number;
|
|
556
|
+
composition: CompositionSpec;
|
|
557
|
+
[movieOption: string]: unknown;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* A deck of pages as one movie. Each page is a nested composition laid out after the one before (so its layers use the page's own
|
|
561
|
+
* time), the stops (where a `Presenter` pauses) come from the pages, and an optional `transition` joins the pages with the existing
|
|
562
|
+
* crossfade / slide / wipe / … transitions.
|
|
563
|
+
*
|
|
564
|
+
* ```js
|
|
565
|
+
* await movie.init({ canvas, width: 1280, height: 720, frameRate: 30, ...deck({
|
|
566
|
+
* transition: { kind: 'slide', duration: 0.6, direction: 'left' },
|
|
567
|
+
* pages: [
|
|
568
|
+
* { name: 'Hello', duration: 5, stops: [1.2], sequences: [ …title, subtitle… ] },
|
|
569
|
+
* { name: 'Why', duration: 8, stops: [1.2, 3, 5], sequences: [ …three bullets, at 1.2, 3, 5… ] },
|
|
570
|
+
* ],
|
|
571
|
+
* }) });
|
|
572
|
+
* movie.on('ready', …); new Presenter(movie, { canvas });
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
575
|
+
declare function deck(options: DeckOptions): DeckResult;
|
|
576
|
+
|
|
348
577
|
interface WiggleProp {
|
|
349
578
|
/** The value the property rests at: a number or an expression (`'W/2'`). The wiggle starts and ends here. */
|
|
350
579
|
around: number | string;
|
|
@@ -422,4 +651,4 @@ interface WithFadeOptions {
|
|
|
422
651
|
*/
|
|
423
652
|
declare function withFade<T extends SequenceCommon>(spec: T, opts: WithFadeOptions): T;
|
|
424
653
|
|
|
425
|
-
export { type AnimateTextOptions, type AnimateTextTween, CameraSequenceSpec, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, type OrbitOptions, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, followPath, kenBurns, measureText, noise, orbit, rand, random, registerSequenceType, splitText, stagger, wiggle, withFade };
|
|
654
|
+
export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, type OrbitOptions, type ParticlesOptions, Props, type ReactOptions, type ReactProp, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, TransitionSpec, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, followPath, kenBurns, measureText, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, M as Movie,
|
|
2
|
-
import { S as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, d as LoaderOption, M as MotionBlurOptions, e as MotionBlurSpec, f as Movie, g as MovieErrorEvent, h as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, i as SoundMeasure, j as StopEvent, k as StopImage, l as StopImagesOptions, T as TimelineData, m as TimelineHtmlOptions, n as TimelineRow, o as TimelineSvgOptions, p as TimelineTransition, V as VolumeEvent, q as dismissLoader, r as failLoader, s as resolveLoader } from './Movie-EBF6_RfX.js';
|
|
2
|
+
import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-mpqQO8MJ.js';
|
|
3
|
+
export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioSequenceSpec, h as AudioSfxSpec, i as ChromaKeyFilterSpec, j as CircleShapeSpec, k as CompositionSequenceSpec, l as CrossfadeTransition, m as CustomFilterSpec, D as DipTransition, n as DissolveTransition, E as EllipseShapeSpec, o as Expr, F as FilterSpec, G as GradientSpec, p as IrisTransition, L as LineShapeSpec, N as NullSequenceSpec, q as PathShapeSpec, r as PolygonShapeSpec, s as PropValue, R as RectShapeSpec, t as SfxKnobs, u as SfxOptions, v as SfxPreset, w as SfxVoice, x as ShapeSequenceSpec, y as SlideTransition, z as Stop, B as StopSpec, H as TransitionCommon, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition, J as normalizeStops } from './types-mpqQO8MJ.js';
|
|
4
|
+
import { S as Sequence } from './Base-CYH9vPCH.js';
|
|
5
5
|
import 'pixi.js';
|
|
6
6
|
import 'gsap';
|
|
7
7
|
|
|
@@ -162,6 +162,78 @@ interface OrbitOptions {
|
|
|
162
162
|
*/
|
|
163
163
|
declare function orbit(opts: OrbitOptions): CameraSequenceSpec;
|
|
164
164
|
|
|
165
|
+
type Range = number | [number, number];
|
|
166
|
+
interface ParticlesOptions {
|
|
167
|
+
/** How many particles. Required. */
|
|
168
|
+
count: number;
|
|
169
|
+
/** When the first one can be born, in composition seconds. Default 0. */
|
|
170
|
+
at?: number;
|
|
171
|
+
/** Births are spread over this many seconds (0, the default, is a burst: all at once). */
|
|
172
|
+
emit?: number;
|
|
173
|
+
/** How long each lives, in seconds: a number or `[min, max]`. Required. */
|
|
174
|
+
life: Range;
|
|
175
|
+
/** Where they start: the centre `x`, `y`, and optionally a `width` / `height` to spread over (snow: `{ x: 640, y: -20, width: 1280 }`). Required. */
|
|
176
|
+
area: {
|
|
177
|
+
x: number;
|
|
178
|
+
y: number;
|
|
179
|
+
width?: number;
|
|
180
|
+
height?: number;
|
|
181
|
+
};
|
|
182
|
+
/** Direction of the launch, degrees: 0 is right, 90 down, −90 up. A number or `[min, max]`. Default `[0, 360]`. */
|
|
183
|
+
angle?: Range;
|
|
184
|
+
/** Launch speed in px per second. Default `[100, 300]`. */
|
|
185
|
+
speed?: Range;
|
|
186
|
+
/** Acceleration down, px/s² (negative floats up). Default 0. */
|
|
187
|
+
gravity?: number;
|
|
188
|
+
/** Acceleration sideways, px/s². Default 0. */
|
|
189
|
+
wind?: number;
|
|
190
|
+
/** Air drag per second: they slow toward a terminal speed. Default 0. */
|
|
191
|
+
drag?: number;
|
|
192
|
+
/** A smooth side-to-side wobble: up to about ±`amp` px, `freq` wobbles per second (default 1). Snow, leaves, embers. */
|
|
193
|
+
sway?: {
|
|
194
|
+
amp: number;
|
|
195
|
+
freq?: number;
|
|
196
|
+
};
|
|
197
|
+
/** Radius in px (a square's half-side): a number or `[min, max]`. Default `[3, 6]`. */
|
|
198
|
+
size?: Range;
|
|
199
|
+
/** Scale over the life, `[start, end]` (`[1, 0]` shrinks away). Default none. */
|
|
200
|
+
scale?: [number, number];
|
|
201
|
+
/** Alpha ramps in seconds: `in` from transparent at birth, `out` back to transparent at the end of the life. */
|
|
202
|
+
fade?: {
|
|
203
|
+
in?: number;
|
|
204
|
+
out?: number;
|
|
205
|
+
};
|
|
206
|
+
/** Fill colours, picked at random for each particle. Default white. */
|
|
207
|
+
colors?: string[];
|
|
208
|
+
/** `'circle'` (default), `'rect'` (a square) or `'star'`. */
|
|
209
|
+
shape?: 'circle' | 'rect' | 'star';
|
|
210
|
+
/** Turning speed in degrees per second (a number or `[min, max]`; they also start at a random angle). Default none. */
|
|
211
|
+
spin?: Range;
|
|
212
|
+
/** Another seed is another burst. Default 0. */
|
|
213
|
+
seed?: number;
|
|
214
|
+
/** Layers are named `<name>-0`, `<name>-1`, … (default `'particle'`). */
|
|
215
|
+
name?: string;
|
|
216
|
+
/** `'add'` makes overlapping particles glow. */
|
|
217
|
+
blendMode?: string;
|
|
218
|
+
/** Use this layer (any type: an image, a text) for every particle instead of a shape; its keyframes are kept. */
|
|
219
|
+
template?: SequenceSpec;
|
|
220
|
+
/** Samples per second of a curved path (gravity, wind, drag, sway): straight steps between them. Default 20. */
|
|
221
|
+
sampleRate?: number;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Particles as plain layers: a burst, a fountain, snow, confetti, sparks. Each one is a layer with its own seeded start,
|
|
225
|
+
* velocity, size, colour and life, and a path baked into keyframes (so playback, seeking and export agree), living only
|
|
226
|
+
* while it is alive. Spread the result into `sequences`.
|
|
227
|
+
*
|
|
228
|
+
* ```js
|
|
229
|
+
* ...particles({ count: 80, at: 2, life: [0.8, 1.6], area: { x: 640, y: 400 }, speed: [150, 450], gravity: 500,
|
|
230
|
+
* size: [3, 7], colors: ['#ffd166', '#ff6b9d', '#4cc9f0'], fade: { out: 0.4 }, blendMode: 'add' })
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* A particle with no gravity, wind, drag or sway is one straight tween; a curved path is sampled `sampleRate` times a second.
|
|
234
|
+
*/
|
|
235
|
+
declare function particles(opts: ParticlesOptions): SequenceSpec[];
|
|
236
|
+
|
|
165
237
|
interface FollowPathOptions {
|
|
166
238
|
/** The route, as SVG path data in the same canvas coordinates the layer's `x` / `y` use. Several sub-paths are walked in order. */
|
|
167
239
|
d: string;
|
|
@@ -345,6 +417,163 @@ interface AnimateTextOptions {
|
|
|
345
417
|
*/
|
|
346
418
|
declare function animateText(text: string, style: MeasureStyle, options: AnimateTextOptions): TextSequenceSpec[];
|
|
347
419
|
|
|
420
|
+
/** The part of an `AudioBuffer` the analysis reads (so it can be tested with plain arrays). */
|
|
421
|
+
interface AudioLike {
|
|
422
|
+
sampleRate: number;
|
|
423
|
+
numberOfChannels: number;
|
|
424
|
+
length: number;
|
|
425
|
+
getChannelData(channel: number): Float32Array;
|
|
426
|
+
}
|
|
427
|
+
interface EnvelopeOptions {
|
|
428
|
+
/** One value per video frame: use your movie's `frameRate`. Default 30. */
|
|
429
|
+
frameRate?: number;
|
|
430
|
+
/** Frequency bands in Hz, `{ name: [from, to] }`. Default `{ bass: [20, 150], mid: [150, 2000], treble: [2000, 10000] }`. */
|
|
431
|
+
bands?: Record<string, [number, number]>;
|
|
432
|
+
/** The band the beats are looked for in (default `'bass'`, or `'level'` if there is no such band). */
|
|
433
|
+
beatBand?: string;
|
|
434
|
+
/** More (above 1) or fewer (below 1) beats. Default 1. */
|
|
435
|
+
beatSensitivity?: number;
|
|
436
|
+
}
|
|
437
|
+
/** What a piece of sound does over time, as numbers between 0 and 1, one per video frame, plus where its beats are. */
|
|
438
|
+
interface AudioEnvelope {
|
|
439
|
+
frameRate: number;
|
|
440
|
+
/** Seconds of sound. */
|
|
441
|
+
duration: number;
|
|
442
|
+
/** Values per series (`frames`). */
|
|
443
|
+
frames: number;
|
|
444
|
+
/** `level` (the overall loudness) and one series per band, each 0–1 on a log (perceptual) scale. */
|
|
445
|
+
series: Record<string, Float32Array>;
|
|
446
|
+
/** Times of the beats, in seconds. */
|
|
447
|
+
beats: number[];
|
|
448
|
+
/** The tempo estimated from the beats (null if there are too few). */
|
|
449
|
+
bpm: number | null;
|
|
450
|
+
/** The value of a series at a time (seconds): interpolated between frames, held at the ends. `series` defaults to `'level'`. */
|
|
451
|
+
at(time: number, series?: string): number;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Analyse a sound: its loudness and the energy in a few frequency bands, one value per video frame (0–1 on a log scale, all measured
|
|
455
|
+
* against the loudest of them, so the balance between bands is kept and a quiet file looks like a loud one), and where its beats are.
|
|
456
|
+
* Pure and deterministic: the same sound gives the same numbers.
|
|
457
|
+
*/
|
|
458
|
+
declare function computeEnvelope(audio: AudioLike, options?: EnvelopeOptions): AudioEnvelope;
|
|
459
|
+
/**
|
|
460
|
+
* A stand-in for analysed music, on a tempo you choose: a kick on every beat (`bass`), a snare on 2 and 4 (`mid`), hats on the eighth
|
|
461
|
+
* notes (`treble`), each a pulse that decays; `level` follows them. Beats are exactly on the beat. Use it with no audio file, or to
|
|
462
|
+
* make visuals that match sound effects you place on the same tempo.
|
|
463
|
+
*/
|
|
464
|
+
declare function bpmEnvelope(bpm: number, options: {
|
|
465
|
+
duration: number;
|
|
466
|
+
frameRate?: number;
|
|
467
|
+
swing?: number;
|
|
468
|
+
}): AudioEnvelope;
|
|
469
|
+
/** What `audioEnvelope()` can read: a URL (string), a Blob / File, the raw bytes of a file, or an `AudioBuffer` you already decoded. */
|
|
470
|
+
type AudioEnvelopeSource = string | URL | Blob | ArrayBuffer | AudioBuffer;
|
|
471
|
+
/**
|
|
472
|
+
* Decode an audio file and analyse it (see {@link computeEnvelope}). Do it before `movie.init`, with the same file the music layer plays,
|
|
473
|
+
* and feed the result to `react()`:
|
|
474
|
+
*
|
|
475
|
+
* ```js
|
|
476
|
+
* const env = await audioEnvelope('music.mp3', { frameRate: 30 });
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
declare function audioEnvelope(source: AudioEnvelopeSource, options?: EnvelopeOptions): Promise<AudioEnvelope>;
|
|
480
|
+
|
|
481
|
+
interface ReactProp {
|
|
482
|
+
/** The value at rest (a level of 0). Default 0. */
|
|
483
|
+
base?: number;
|
|
484
|
+
/** How far the value goes at a level of 1 (can be negative). Required. */
|
|
485
|
+
amount: number;
|
|
486
|
+
/** Which series of the envelope drives it: `'level'` (default) or a band (`'bass'`, `'mid'`, `'treble'`, or your own). */
|
|
487
|
+
band?: string;
|
|
488
|
+
/** Follow the beats instead: a jump to full on each beat, falling off after it (see `decay`). */
|
|
489
|
+
beats?: boolean;
|
|
490
|
+
/** With `beats`: seconds for the pulse to fall to 37 %. Default 0.2. */
|
|
491
|
+
decay?: number;
|
|
492
|
+
/** Smoothing, in seconds, for a level that rises (`attack`) and falls (`release`), like a level meter: a quick rise and a slow fall looks like a bounce. Default none. */
|
|
493
|
+
attack?: number;
|
|
494
|
+
release?: number;
|
|
495
|
+
/** Use 1 − level (it gets smaller as the sound gets louder). */
|
|
496
|
+
invert?: boolean;
|
|
497
|
+
/** Raise the level to this power first: above 1 only the loud parts move it (a punchier look), below 1 even the quiet ones do. Default 1. */
|
|
498
|
+
curve?: number;
|
|
499
|
+
}
|
|
500
|
+
interface ReactOptions {
|
|
501
|
+
/** Start, in seconds from the start of the layer. Default 0. */
|
|
502
|
+
at?: number;
|
|
503
|
+
/** How long it follows the sound, in seconds. Required. */
|
|
504
|
+
duration: number;
|
|
505
|
+
/** The properties to move and how, each its own way: `{ scale: { base: 1, amount: 0.3, band: 'bass' }, alpha: { base: 0.3, amount: 0.7 } }`. */
|
|
506
|
+
props: Record<string, ReactProp>;
|
|
507
|
+
/** Where in the sound the layer's start is, in seconds (the layer starts 2 s after the music began: `audioOffset: 2`). Default 0. */
|
|
508
|
+
audioOffset?: number;
|
|
509
|
+
/** The sound repeats (a looping music layer) instead of the last value being held. */
|
|
510
|
+
loop?: boolean;
|
|
511
|
+
/** Samples per second (default: the envelope's, so one per video frame). Lower it for a long layer, the steps get longer. */
|
|
512
|
+
frameRate?: number;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Keyframes that follow a sound: `base + amount × level` sampled once per frame from an envelope (`audioEnvelope()` for a real file,
|
|
516
|
+
* `bpmEnvelope()` for a tempo), so playback, seeking and export all agree. Put the result in a layer's `keyframes`.
|
|
517
|
+
*
|
|
518
|
+
* ```js
|
|
519
|
+
* const env = await audioEnvelope('music.mp3', { frameRate: 30 });
|
|
520
|
+
* { type: 'shape', shape: 'circle', radius: 120, initial: { x: 640, y: 360 },
|
|
521
|
+
* keyframes: react(env, { duration: 12, props: { scale: { base: 1, amount: 0.4, band: 'bass', attack: 0.02, release: 0.2 } } }) }
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
declare function react(env: AudioEnvelope, options: ReactOptions): Keyframe[];
|
|
525
|
+
|
|
526
|
+
interface DeckPage {
|
|
527
|
+
/** The page's name: shown by the Presenter, and in the stops list. */
|
|
528
|
+
name?: string;
|
|
529
|
+
/** How long the page lasts, seconds (including any transition into the next page, see `DeckOptions.transition`). Required. */
|
|
530
|
+
duration: number;
|
|
531
|
+
/** The page's layers, written in the page's own time (`at: 0` is the start of the page). */
|
|
532
|
+
sequences: SequenceSpec[];
|
|
533
|
+
/** Where the page stops, in the page's own time: the first is the page settled, the rest are steps (a bullet appears, a chart grows). Default: where the transition into the next page begins (the end for the last page). */
|
|
534
|
+
stops?: number[];
|
|
535
|
+
/** Speaker notes (kept on the page's first stop). */
|
|
536
|
+
notes?: string;
|
|
537
|
+
/** Move on by itself this many seconds after the page's last stop (kiosk mode). */
|
|
538
|
+
advance?: number;
|
|
539
|
+
/** The page is itself a layer: it may carry `initial`, `keyframes`, `filters`, … (fade or slide the whole page, for instance). */
|
|
540
|
+
initial?: Props;
|
|
541
|
+
keyframes?: Keyframe[];
|
|
542
|
+
}
|
|
543
|
+
/** A transition spec without the parts `deck()` fills in (which two pages, and when). */
|
|
544
|
+
type DeckTransition = TransitionSpec extends infer T ? (T extends TransitionSpec ? Omit<T, 'from' | 'to' | 'at'> : never) : never;
|
|
545
|
+
interface DeckOptions {
|
|
546
|
+
pages: DeckPage[];
|
|
547
|
+
/**
|
|
548
|
+
* A transition between every two pages: `{ kind: 'crossfade' | 'slide' | 'wipe' | 'iris' | 'dip' | 'zoom' | 'dissolve', duration, …its own options }` (see Transitions). The next page starts
|
|
549
|
+
* `duration` seconds before the current one ends, and the transition plays across the overlap.
|
|
550
|
+
*/
|
|
551
|
+
transition?: DeckTransition;
|
|
552
|
+
}
|
|
553
|
+
/** What `deck()` returns: spread it into `movie.init` (`{ duration, composition: { sequences, transitions?, stops } }` plus any movie option you passed). */
|
|
554
|
+
interface DeckResult {
|
|
555
|
+
duration: number;
|
|
556
|
+
composition: CompositionSpec;
|
|
557
|
+
[movieOption: string]: unknown;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* A deck of pages as one movie. Each page is a nested composition laid out after the one before (so its layers use the page's own
|
|
561
|
+
* time), the stops (where a `Presenter` pauses) come from the pages, and an optional `transition` joins the pages with the existing
|
|
562
|
+
* crossfade / slide / wipe / … transitions.
|
|
563
|
+
*
|
|
564
|
+
* ```js
|
|
565
|
+
* await movie.init({ canvas, width: 1280, height: 720, frameRate: 30, ...deck({
|
|
566
|
+
* transition: { kind: 'slide', duration: 0.6, direction: 'left' },
|
|
567
|
+
* pages: [
|
|
568
|
+
* { name: 'Hello', duration: 5, stops: [1.2], sequences: [ …title, subtitle… ] },
|
|
569
|
+
* { name: 'Why', duration: 8, stops: [1.2, 3, 5], sequences: [ …three bullets, at 1.2, 3, 5… ] },
|
|
570
|
+
* ],
|
|
571
|
+
* }) });
|
|
572
|
+
* movie.on('ready', …); new Presenter(movie, { canvas });
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
575
|
+
declare function deck(options: DeckOptions): DeckResult;
|
|
576
|
+
|
|
348
577
|
interface WiggleProp {
|
|
349
578
|
/** The value the property rests at: a number or an expression (`'W/2'`). The wiggle starts and ends here. */
|
|
350
579
|
around: number | string;
|
|
@@ -422,4 +651,4 @@ interface WithFadeOptions {
|
|
|
422
651
|
*/
|
|
423
652
|
declare function withFade<T extends SequenceCommon>(spec: T, opts: WithFadeOptions): T;
|
|
424
653
|
|
|
425
|
-
export { type AnimateTextOptions, type AnimateTextTween, CameraSequenceSpec, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, type OrbitOptions, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, followPath, kenBurns, measureText, noise, orbit, rand, random, registerSequenceType, splitText, stagger, wiggle, withFade };
|
|
654
|
+
export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, type OrbitOptions, type ParticlesOptions, Props, type ReactOptions, type ReactProp, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, TransitionSpec, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, followPath, kenBurns, measureText, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
|