pixi-effects 0.26.2 → 0.27.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 +28 -0
- package/README.md +8 -10
- package/ai/CHAT.md +1 -1
- package/ai/chat-template.html +4 -6
- package/ai/tools/render.mjs +16 -11
- package/dist/{Base-CpdDs4HT.d.ts → Base-CVezIEdo.d.ts} +2 -4
- package/dist/{Base-TbBhHPrG.d.cts → Base-DzC3i919.d.cts} +2 -4
- package/dist/Composition-4TYDRRRY.js +7 -0
- package/dist/{Composition-H4QA24MV.js.map → Composition-4TYDRRRY.js.map} +1 -1
- package/dist/Composition-QCOWQSDB.cjs +16 -0
- package/dist/{Composition-HM4YT5L7.cjs.map → Composition-QCOWQSDB.cjs.map} +1 -1
- package/dist/Controller.d.cts +2 -3
- package/dist/Controller.d.ts +2 -3
- package/dist/{Movie-i05Oh9mJ.d.cts → Movie-CQ0Nz62a.d.cts} +12 -6
- package/dist/{Movie-DVeDTdnc.d.ts → Movie-M9dKm9dI.d.ts} +12 -6
- package/dist/Presenter.d.cts +2 -3
- package/dist/Presenter.d.ts +2 -3
- package/dist/{blendModes-YV43K6E7.cjs → blendModes-HDOP6R7T.cjs} +5 -5
- package/dist/{blendModes-YV43K6E7.cjs.map → blendModes-HDOP6R7T.cjs.map} +1 -1
- package/dist/{blendModes-G3NOAU3T.js → blendModes-PAVTW3BO.js} +4 -4
- package/dist/{blendModes-G3NOAU3T.js.map → blendModes-PAVTW3BO.js.map} +1 -1
- package/dist/{chunk-TLYTYBWX.js → chunk-45QKLD6M.js} +9 -11
- package/dist/chunk-45QKLD6M.js.map +1 -0
- package/dist/{chunk-GBUM7X2S.js → chunk-CKTS6G6I.js} +7 -11
- package/dist/chunk-CKTS6G6I.js.map +1 -0
- package/dist/{chunk-555URQHQ.cjs → chunk-NDR2VQFV.cjs} +91 -95
- package/dist/chunk-NDR2VQFV.cjs.map +1 -0
- package/dist/{chunk-3DLYAPK7.cjs → chunk-P4GY3Z4G.cjs} +5 -5
- package/dist/{chunk-3DLYAPK7.cjs.map → chunk-P4GY3Z4G.cjs.map} +1 -1
- package/dist/{chunk-WPXDRSGN.cjs → chunk-RQMI7EJT.cjs} +1170 -280
- package/dist/chunk-RQMI7EJT.cjs.map +1 -0
- package/dist/{chunk-X3HB4DSR.js → chunk-TGJACVLD.js} +1150 -263
- package/dist/chunk-TGJACVLD.js.map +1 -0
- package/dist/{chunk-AXZUKNXF.js → chunk-TYWFKCPY.js} +4 -4
- package/dist/{chunk-AXZUKNXF.js.map → chunk-TYWFKCPY.js.map} +1 -1
- package/dist/{chunk-ECA2WNRX.cjs → chunk-ZMAD3KJU.cjs} +9 -11
- package/dist/chunk-ZMAD3KJU.cjs.map +1 -0
- package/dist/index.cjs +189 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -14
- package/dist/index.d.ts +16 -14
- package/dist/index.js +136 -45
- package/dist/index.js.map +1 -1
- package/dist/loader.css +1 -1
- package/dist/three.cjs +6 -6
- package/dist/three.d.cts +2 -3
- package/dist/three.d.ts +2 -3
- package/dist/three.js +2 -2
- package/dist/{types-DSGwN5w1.d.ts → types-DUVefWiB.d.cts} +128 -3
- package/dist/{types-DSGwN5w1.d.cts → types-DUVefWiB.d.ts} +128 -3
- package/docs/api.md +16 -6
- package/docs/dsl.md +14 -14
- package/llms-full.txt +38 -28
- package/llms.txt +1 -1
- package/package.json +3 -4
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/cheatsheet.md +3 -3
- package/skills/pixi-effects/reference/pitfalls.md +3 -3
- package/skills/pixi-effects/reference/recipes.md +1 -1
- package/skills/pixi-effects/template.html +6 -8
- package/dist/Composition-H4QA24MV.js +0 -7
- package/dist/Composition-HM4YT5L7.cjs +0 -16
- package/dist/chunk-555URQHQ.cjs.map +0 -1
- package/dist/chunk-ECA2WNRX.cjs.map +0 -1
- package/dist/chunk-GBUM7X2S.js.map +0 -1
- package/dist/chunk-TLYTYBWX.js.map +0 -1
- package/dist/chunk-WPXDRSGN.cjs.map +0 -1
- package/dist/chunk-X3HB4DSR.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-
|
|
2
|
-
import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-
|
|
3
|
-
export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-
|
|
4
|
-
import { S as Sequence } from './Base-
|
|
1
|
+
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-CQ0Nz62a.cjs';
|
|
2
|
+
import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-DUVefWiB.cjs';
|
|
3
|
+
export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-DUVefWiB.cjs';
|
|
4
|
+
import { S as Sequence } from './Base-DzC3i919.cjs';
|
|
5
5
|
import 'pixi.js';
|
|
6
|
-
import 'gsap';
|
|
7
6
|
|
|
8
7
|
/** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
|
|
9
8
|
type MeasureStyle = Record<string, unknown>;
|
|
@@ -60,6 +59,9 @@ type SequenceCtor = {
|
|
|
60
59
|
/** Register an external sequence type. Later registrations overwrite earlier ones. */
|
|
61
60
|
declare function registerSequenceType(type: string, ctor: SequenceCtor): void;
|
|
62
61
|
|
|
62
|
+
/** Resolve an ease name to a function (0–1 → 0–1). An unknown name warns once and runs as the default ease, `power1.out`. */
|
|
63
|
+
declare function parseEase(name: string): (p: number) => number;
|
|
64
|
+
|
|
63
65
|
type KenBurnsOptions = KenBurnsBase & ({
|
|
64
66
|
motion: 'still';
|
|
65
67
|
} | KenBurnsScale | KenBurnsRotation | KenBurnsPosition);
|
|
@@ -74,7 +76,7 @@ interface KenBurnsBase {
|
|
|
74
76
|
duration: number;
|
|
75
77
|
/** How the image fills the canvas. Default `'cover'`. */
|
|
76
78
|
fit?: 'cover' | 'contain';
|
|
77
|
-
/**
|
|
79
|
+
/** Ease name. Default `'sine.inOut'`. */
|
|
78
80
|
ease?: string;
|
|
79
81
|
}
|
|
80
82
|
interface KenBurnsScale {
|
|
@@ -128,7 +130,7 @@ interface OrbitOptions {
|
|
|
128
130
|
height?: number;
|
|
129
131
|
/** Vertical field of view, degrees. Default 40. Written to the camera. */
|
|
130
132
|
fov?: number;
|
|
131
|
-
/** Easing of the sweep as a whole (any
|
|
133
|
+
/** Easing of the sweep as a whole (any ease name). Default `'sine.inOut'`. */
|
|
132
134
|
ease?: string;
|
|
133
135
|
/**
|
|
134
136
|
* A dolly zoom while orbiting: `fov` animates from `from` to `to` (degrees) and the radius follows it
|
|
@@ -241,7 +243,7 @@ interface FollowPathOptions {
|
|
|
241
243
|
at?: number;
|
|
242
244
|
/** How long the trip takes, in seconds. Required. */
|
|
243
245
|
duration: number;
|
|
244
|
-
/**
|
|
246
|
+
/** Ease for the progress along the path (default `'none'`: constant speed). */
|
|
245
247
|
ease?: string;
|
|
246
248
|
/** Where on the path to start and stop, as fractions 0–1 of its length (default 0 → 1). `from: 1, to: 0` goes backwards. */
|
|
247
249
|
from?: number;
|
|
@@ -275,7 +277,7 @@ interface CameraPathOptions {
|
|
|
275
277
|
at?: number;
|
|
276
278
|
/** How long the flight takes, in seconds. Required. */
|
|
277
279
|
duration: number;
|
|
278
|
-
/**
|
|
280
|
+
/** Ease for the progress along the route (default `'none'`: constant speed; `'power2.in'` is an accelerating rush). */
|
|
279
281
|
ease?: string;
|
|
280
282
|
/** Where the camera looks: a fixed `[x, y, z]`, or `'ahead'` (default): a point further along the route, so it faces where it flies. */
|
|
281
283
|
look?: [number, number, number] | 'ahead';
|
|
@@ -312,13 +314,13 @@ interface StaggerOptions {
|
|
|
312
314
|
from?: 'start' | 'end' | 'center' | 'edges' | 'random' | number;
|
|
313
315
|
/** `[columns, rows]`: the items fill a grid row by row and the wave travels by straight-line distance across it. */
|
|
314
316
|
grid?: [number, number];
|
|
315
|
-
/**
|
|
317
|
+
/** Ease that reshapes the spread (default `'none'`: even steps). The first stays at 0, the last at the full spread. */
|
|
316
318
|
ease?: string;
|
|
317
319
|
/** For `from: 'random'`: another seed is another order. Default 0. */
|
|
318
320
|
seed?: number;
|
|
319
321
|
}
|
|
320
322
|
/**
|
|
321
|
-
* Delays for a wave of items, in seconds, in the style of GSAP's `stagger
|
|
323
|
+
* Delays for a wave of items, in seconds, in the style of GSAP's `stagger` (its names, with thanks).
|
|
322
324
|
*
|
|
323
325
|
* stagger(6, { each: 0.08 }) // [0, 0.08, 0.16, …] use: `at: 1 + d[i]`
|
|
324
326
|
* stagger(letters, { each: 0.05, from: 'center' }) // the same layers with their `at` pushed back
|
|
@@ -400,7 +402,7 @@ interface AnimateTextTween {
|
|
|
400
402
|
to?: Record<string, number>;
|
|
401
403
|
/** Seconds each piece takes. */
|
|
402
404
|
duration?: number;
|
|
403
|
-
/**
|
|
405
|
+
/** Ease name. */
|
|
404
406
|
ease?: string;
|
|
405
407
|
}
|
|
406
408
|
interface AnimateTextOptions {
|
|
@@ -654,7 +656,7 @@ interface WiggleOptions {
|
|
|
654
656
|
freq?: number;
|
|
655
657
|
/** Another seed is another take of the same shake. Default 0. */
|
|
656
658
|
seed?: number;
|
|
657
|
-
/**
|
|
659
|
+
/** Ease between targets. Default `'sine.inOut'`; `'none'` gives straight, jittery lines. */
|
|
658
660
|
ease?: string;
|
|
659
661
|
/** The properties to move, each independently: `{ x: { around: 960, amp: 6 }, rotation: { around: 0, amp: 1.5 } }`. */
|
|
660
662
|
props: Record<string, WiggleProp>;
|
|
@@ -716,4 +718,4 @@ interface WithFadeOptions {
|
|
|
716
718
|
*/
|
|
717
719
|
declare function withFade<T extends SequenceCommon>(spec: T, opts: WithFadeOptions): T;
|
|
718
720
|
|
|
719
|
-
export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, type CameraPathOptions, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, MusicOptions, 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, cameraPath, computeEnvelope, deck, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
|
|
721
|
+
export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, type CameraPathOptions, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, MusicOptions, 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, cameraPath, computeEnvelope, deck, parseEase as ease, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-
|
|
2
|
-
import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-
|
|
3
|
-
export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-
|
|
4
|
-
import { S as Sequence } from './Base-
|
|
1
|
+
export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-M9dKm9dI.js';
|
|
2
|
+
import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-DUVefWiB.js';
|
|
3
|
+
export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-DUVefWiB.js';
|
|
4
|
+
import { S as Sequence } from './Base-CVezIEdo.js';
|
|
5
5
|
import 'pixi.js';
|
|
6
|
-
import 'gsap';
|
|
7
6
|
|
|
8
7
|
/** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
|
|
9
8
|
type MeasureStyle = Record<string, unknown>;
|
|
@@ -60,6 +59,9 @@ type SequenceCtor = {
|
|
|
60
59
|
/** Register an external sequence type. Later registrations overwrite earlier ones. */
|
|
61
60
|
declare function registerSequenceType(type: string, ctor: SequenceCtor): void;
|
|
62
61
|
|
|
62
|
+
/** Resolve an ease name to a function (0–1 → 0–1). An unknown name warns once and runs as the default ease, `power1.out`. */
|
|
63
|
+
declare function parseEase(name: string): (p: number) => number;
|
|
64
|
+
|
|
63
65
|
type KenBurnsOptions = KenBurnsBase & ({
|
|
64
66
|
motion: 'still';
|
|
65
67
|
} | KenBurnsScale | KenBurnsRotation | KenBurnsPosition);
|
|
@@ -74,7 +76,7 @@ interface KenBurnsBase {
|
|
|
74
76
|
duration: number;
|
|
75
77
|
/** How the image fills the canvas. Default `'cover'`. */
|
|
76
78
|
fit?: 'cover' | 'contain';
|
|
77
|
-
/**
|
|
79
|
+
/** Ease name. Default `'sine.inOut'`. */
|
|
78
80
|
ease?: string;
|
|
79
81
|
}
|
|
80
82
|
interface KenBurnsScale {
|
|
@@ -128,7 +130,7 @@ interface OrbitOptions {
|
|
|
128
130
|
height?: number;
|
|
129
131
|
/** Vertical field of view, degrees. Default 40. Written to the camera. */
|
|
130
132
|
fov?: number;
|
|
131
|
-
/** Easing of the sweep as a whole (any
|
|
133
|
+
/** Easing of the sweep as a whole (any ease name). Default `'sine.inOut'`. */
|
|
132
134
|
ease?: string;
|
|
133
135
|
/**
|
|
134
136
|
* A dolly zoom while orbiting: `fov` animates from `from` to `to` (degrees) and the radius follows it
|
|
@@ -241,7 +243,7 @@ interface FollowPathOptions {
|
|
|
241
243
|
at?: number;
|
|
242
244
|
/** How long the trip takes, in seconds. Required. */
|
|
243
245
|
duration: number;
|
|
244
|
-
/**
|
|
246
|
+
/** Ease for the progress along the path (default `'none'`: constant speed). */
|
|
245
247
|
ease?: string;
|
|
246
248
|
/** Where on the path to start and stop, as fractions 0–1 of its length (default 0 → 1). `from: 1, to: 0` goes backwards. */
|
|
247
249
|
from?: number;
|
|
@@ -275,7 +277,7 @@ interface CameraPathOptions {
|
|
|
275
277
|
at?: number;
|
|
276
278
|
/** How long the flight takes, in seconds. Required. */
|
|
277
279
|
duration: number;
|
|
278
|
-
/**
|
|
280
|
+
/** Ease for the progress along the route (default `'none'`: constant speed; `'power2.in'` is an accelerating rush). */
|
|
279
281
|
ease?: string;
|
|
280
282
|
/** Where the camera looks: a fixed `[x, y, z]`, or `'ahead'` (default): a point further along the route, so it faces where it flies. */
|
|
281
283
|
look?: [number, number, number] | 'ahead';
|
|
@@ -312,13 +314,13 @@ interface StaggerOptions {
|
|
|
312
314
|
from?: 'start' | 'end' | 'center' | 'edges' | 'random' | number;
|
|
313
315
|
/** `[columns, rows]`: the items fill a grid row by row and the wave travels by straight-line distance across it. */
|
|
314
316
|
grid?: [number, number];
|
|
315
|
-
/**
|
|
317
|
+
/** Ease that reshapes the spread (default `'none'`: even steps). The first stays at 0, the last at the full spread. */
|
|
316
318
|
ease?: string;
|
|
317
319
|
/** For `from: 'random'`: another seed is another order. Default 0. */
|
|
318
320
|
seed?: number;
|
|
319
321
|
}
|
|
320
322
|
/**
|
|
321
|
-
* Delays for a wave of items, in seconds, in the style of GSAP's `stagger
|
|
323
|
+
* Delays for a wave of items, in seconds, in the style of GSAP's `stagger` (its names, with thanks).
|
|
322
324
|
*
|
|
323
325
|
* stagger(6, { each: 0.08 }) // [0, 0.08, 0.16, …] use: `at: 1 + d[i]`
|
|
324
326
|
* stagger(letters, { each: 0.05, from: 'center' }) // the same layers with their `at` pushed back
|
|
@@ -400,7 +402,7 @@ interface AnimateTextTween {
|
|
|
400
402
|
to?: Record<string, number>;
|
|
401
403
|
/** Seconds each piece takes. */
|
|
402
404
|
duration?: number;
|
|
403
|
-
/**
|
|
405
|
+
/** Ease name. */
|
|
404
406
|
ease?: string;
|
|
405
407
|
}
|
|
406
408
|
interface AnimateTextOptions {
|
|
@@ -654,7 +656,7 @@ interface WiggleOptions {
|
|
|
654
656
|
freq?: number;
|
|
655
657
|
/** Another seed is another take of the same shake. Default 0. */
|
|
656
658
|
seed?: number;
|
|
657
|
-
/**
|
|
659
|
+
/** Ease between targets. Default `'sine.inOut'`; `'none'` gives straight, jittery lines. */
|
|
658
660
|
ease?: string;
|
|
659
661
|
/** The properties to move, each independently: `{ x: { around: 960, amp: 6 }, rotation: { around: 0, amp: 1.5 } }`. */
|
|
660
662
|
props: Record<string, WiggleProp>;
|
|
@@ -716,4 +718,4 @@ interface WithFadeOptions {
|
|
|
716
718
|
*/
|
|
717
719
|
declare function withFade<T extends SequenceCommon>(spec: T, opts: WithFadeOptions): T;
|
|
718
720
|
|
|
719
|
-
export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, type CameraPathOptions, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, MusicOptions, 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, cameraPath, computeEnvelope, deck, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
|
|
721
|
+
export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, type CameraPathOptions, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, MusicOptions, 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, cameraPath, computeEnvelope, deck, parseEase as ease, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { CompositionSequence, maskSourceOf } from './chunk-
|
|
2
|
-
import { ensureFilterLibrary, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, rand, DEG, timeRemapOf, contentLength, resolveAt
|
|
3
|
-
export { noise, rand, random, registerSequenceType } from './chunk-
|
|
4
|
-
import { usesAdvancedBlend, enableAdvancedBlend } from './chunk-
|
|
5
|
-
import { collectPropKeys } from './chunk-
|
|
1
|
+
import { CompositionSequence, maskSourceOf } from './chunk-CKTS6G6I.js';
|
|
2
|
+
import { createTimeline, lengthen, ensureFilterLibrary, checkEase, parseEase, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, rand, DEG, timeRemapOf, contentLength, resolveAt } from './chunk-TGJACVLD.js';
|
|
3
|
+
export { noise, rand, random, registerSequenceType } from './chunk-TGJACVLD.js';
|
|
4
|
+
import { usesAdvancedBlend, enableAdvancedBlend } from './chunk-TYWFKCPY.js';
|
|
5
|
+
import { collectPropKeys } from './chunk-45QKLD6M.js';
|
|
6
6
|
import { warnUnknownOptions, suggestName } from './chunk-BXOCEZ4U.js';
|
|
7
|
-
import * as PIXI from 'pixi.js';
|
|
8
7
|
import { extensions, CullerPlugin, Application, Container, Rectangle, Culler, CanvasTextMetrics, TextStyle, Assets, ExtensionType, Filter, Texture, UniformGroup, GpuProgram, GlProgram, defaultFilterVert } from 'pixi.js';
|
|
9
|
-
import {
|
|
10
|
-
import { PixiPlugin } from 'gsap/PixiPlugin';
|
|
11
|
-
import { QUALITY_VERY_HIGH, QUALITY_HIGH, QUALITY_MEDIUM, QUALITY_LOW, QUALITY_VERY_LOW, Output, BufferTarget, CanvasSource, AudioBufferSource, Input, ALL_FORMATS, BlobSource, WavOutputFormat, Conversion, VideoSampleSink, MkvOutputFormat, WebMOutputFormat, MovOutputFormat, Mp4OutputFormat, getFirstEncodableAudioCodec } from 'mediabunny';
|
|
8
|
+
import { Output, BufferTarget, CanvasSource, AudioBufferSource, Input, ALL_FORMATS, BlobSource, WavOutputFormat, Conversion, VideoSampleSink, OggOutputFormat, QUALITY_VERY_HIGH, QUALITY_HIGH, QUALITY_MEDIUM, QUALITY_LOW, QUALITY_VERY_LOW, MkvOutputFormat, WebMOutputFormat, MovOutputFormat, Mp4OutputFormat, canEncodeVideo, getFirstEncodableAudioCodec } from 'mediabunny';
|
|
12
9
|
|
|
13
10
|
var registered = false;
|
|
14
11
|
function ensureLoadersRegistered(audioContext) {
|
|
@@ -759,24 +756,70 @@ function resolveRenderOptions(o) {
|
|
|
759
756
|
};
|
|
760
757
|
}
|
|
761
758
|
|
|
762
|
-
// src/core/
|
|
763
|
-
var
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
759
|
+
// src/core/renderOptions.ts
|
|
760
|
+
var QUALITY_NAMES = ["very-low", "low", "medium", "high", "very-high"];
|
|
761
|
+
function parseBitrate(v) {
|
|
762
|
+
if (v === void 0 || v === null) return {};
|
|
763
|
+
if (typeof v === "string" && QUALITY_NAMES.includes(v)) return { quality: v };
|
|
764
|
+
if (typeof v === "number" && Number.isFinite(v) && v > 0) return { bps: Math.round(v) };
|
|
765
|
+
const m = typeof v === "string" ? /^\s*(\d+(?:\.\d+)?)\s*([kKmM]?)\s*$/.exec(v) : null;
|
|
766
|
+
if (m) {
|
|
767
|
+
const n = Number(m[1]) * { "": 1, k: 1e3, m: 1e6 }[m[2].toLowerCase()];
|
|
768
|
+
if (n > 0) return { bps: Math.round(n) };
|
|
769
|
+
}
|
|
770
|
+
throw new Error(`pixi-effects: bitrate ${JSON.stringify(v)}: use a quality (${QUALITY_NAMES.join(", ")}) or bits a second (8000000, '8M', '800k')`);
|
|
771
|
+
}
|
|
772
|
+
var AUDIO_FORMATS = ["wav", "ogg"];
|
|
773
|
+
var isAudioFormat = (f) => AUDIO_FORMATS.includes(f);
|
|
774
|
+
var VIDEO_CODEC_PREFERENCE = {
|
|
775
|
+
mp4: ["avc", "hevc", "vp9", "av1"],
|
|
776
|
+
mov: ["avc", "hevc"],
|
|
777
|
+
webm: ["vp9", "av1", "vp8"],
|
|
778
|
+
mkv: ["vp9", "avc", "hevc", "av1", "vp8"]
|
|
768
779
|
};
|
|
769
|
-
var
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
780
|
+
var CODEC_ALIASES = {
|
|
781
|
+
h264: "avc",
|
|
782
|
+
"h.264": "avc",
|
|
783
|
+
x264: "avc",
|
|
784
|
+
avc1: "avc",
|
|
785
|
+
h265: "hevc",
|
|
786
|
+
"h.265": "hevc",
|
|
787
|
+
x265: "hevc",
|
|
788
|
+
hvc1: "hevc",
|
|
789
|
+
hev1: "hevc",
|
|
790
|
+
vp09: "vp9",
|
|
791
|
+
"vp-9": "vp9",
|
|
792
|
+
av01: "av1",
|
|
793
|
+
vp80: "vp8",
|
|
794
|
+
"vp-8": "vp8"
|
|
774
795
|
};
|
|
796
|
+
async function chooseVideoCodec(a) {
|
|
797
|
+
const held = a.supported ?? VIDEO_CODEC_PREFERENCE[a.fmt];
|
|
798
|
+
const order = VIDEO_CODEC_PREFERENCE[a.fmt].filter((c) => held.includes(c));
|
|
799
|
+
const firstThatWorks = async (list) => {
|
|
800
|
+
for (const c of list) if (await a.canEncode(c)) return c;
|
|
801
|
+
return null;
|
|
802
|
+
};
|
|
803
|
+
if (a.requested) {
|
|
804
|
+
const alias = CODEC_ALIASES[a.requested.toLowerCase()];
|
|
805
|
+
if (alias) throw new Error(`pixi-effects: render({ video: { codec: "${a.requested}" } }): "${a.requested}" is not a codec name here; did you mean "${alias}"?`);
|
|
806
|
+
if (!order.includes(a.requested)) throw new Error(`pixi-effects: render(): "${a.requested}" cannot go in ${a.fmt} (${a.fmt} holds ${order.join(", ")})`);
|
|
807
|
+
if (await a.canEncode(a.requested)) return { codec: a.requested };
|
|
808
|
+
const alt = await firstThatWorks(order.filter((c) => c !== a.requested));
|
|
809
|
+
throw new Error(`pixi-effects: this browser cannot encode "${a.requested}" video for ${a.fmt}` + (alt ? `; "${alt}" would work: render({ format: '${a.fmt}', video: { codec: '${alt}' } }), or leave video.codec out and the best one is chosen.` : "; it can encode none of " + order.join(", ") + "."));
|
|
810
|
+
}
|
|
811
|
+
const chosen = await firstThatWorks(order);
|
|
812
|
+
if (!chosen) throw new Error(`pixi-effects: this browser has no video encoder for ${a.fmt} (it tried ${order.join(", ")}): try another browser, or another format`);
|
|
813
|
+
return chosen === order[0] ? { codec: chosen } : { codec: chosen, fellBackFrom: order[0] };
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// src/core/Renderer.ts
|
|
775
817
|
var AUDIO_PREFERENCE = {
|
|
776
818
|
mp4: ["aac", "opus", "mp3", "flac"],
|
|
777
819
|
mov: ["aac", "mp3"],
|
|
778
820
|
webm: ["opus", "vorbis"],
|
|
779
|
-
mkv: ["opus", "vorbis", "aac", "flac", "mp3"]
|
|
821
|
+
mkv: ["opus", "vorbis", "aac", "flac", "mp3"],
|
|
822
|
+
ogg: ["opus", "vorbis", "flac"]
|
|
780
823
|
};
|
|
781
824
|
async function chooseAudioCodec(fmt, requested, container, audio, bitrate) {
|
|
782
825
|
const supported = container.getSupportedAudioCodecs?.();
|
|
@@ -801,6 +844,10 @@ var qualityMap = {
|
|
|
801
844
|
"high": QUALITY_HIGH,
|
|
802
845
|
"very-high": QUALITY_VERY_HIGH
|
|
803
846
|
};
|
|
847
|
+
function bitrateOf(v, fallback) {
|
|
848
|
+
const b = parseBitrate(v);
|
|
849
|
+
return b.bps ?? (b.quality ? qualityMap[b.quality] : fallback);
|
|
850
|
+
}
|
|
804
851
|
function makeOutputFormat(name) {
|
|
805
852
|
switch (name) {
|
|
806
853
|
case "mp4":
|
|
@@ -820,19 +867,47 @@ function sliceAudio(buffer, fromSec, toSec, fadeIn, fadeOut) {
|
|
|
820
867
|
cut.forEach((data, c) => out.copyToChannel(data, c));
|
|
821
868
|
return out;
|
|
822
869
|
}
|
|
870
|
+
async function exportAudioOnly(movie, options, fmt, range2) {
|
|
871
|
+
if (!movie.audioBuffer) {
|
|
872
|
+
throw new Error(`pixi-effects: render({ format: '${fmt}' }): this movie has no sound to export (add an audio layer, an sfx or a music score); for the picture use mp4, webm, mov or mkv`);
|
|
873
|
+
}
|
|
874
|
+
if (options.video) console.warn(`pixi-effects: render({ format: '${fmt}' }): video options are ignored, only the sound is written`);
|
|
875
|
+
const audio = range2.partial ? sliceAudio(movie.audioBuffer, range2.fromSec, range2.toSec, range2.fromFrame > 0, range2.toFrame < movie.totalFrames) : movie.audioBuffer;
|
|
876
|
+
const container = fmt === "wav" ? new WavOutputFormat() : new OggOutputFormat();
|
|
877
|
+
let codec;
|
|
878
|
+
if (fmt === "wav") {
|
|
879
|
+
codec = options.audio?.codec ?? "pcm-s16";
|
|
880
|
+
const held = container.getSupportedAudioCodecs();
|
|
881
|
+
if (!held.includes(codec)) throw new Error(`pixi-effects: render({ format: 'wav', audio: { codec: "${codec}" } }): wav holds ${held.join(", ")} (the usual is pcm-s16)`);
|
|
882
|
+
} else {
|
|
883
|
+
codec = await chooseAudioCodec("ogg", options.audio?.codec, container, audio, bitrateOf(options.audio?.bitrate, QUALITY_HIGH));
|
|
884
|
+
}
|
|
885
|
+
const output = new Output({ format: container, target: new BufferTarget() });
|
|
886
|
+
const source = new AudioBufferSource({ codec, ...fmt === "wav" ? {} : { bitrate: bitrateOf(options.audio?.bitrate, QUALITY_HIGH) } });
|
|
887
|
+
output.addAudioTrack(source);
|
|
888
|
+
movie.emit("progress", { progress: 0, frame: range2.fromFrame, totalFrames: movie.totalFrames });
|
|
889
|
+
await output.start();
|
|
890
|
+
await source.add(audio);
|
|
891
|
+
await source.close();
|
|
892
|
+
await output.finalize();
|
|
893
|
+
movie.emit("progress", { progress: 100, frame: range2.toFrame, totalFrames: movie.totalFrames });
|
|
894
|
+
return new Blob([output.target.buffer], { type: output.format.mimeType });
|
|
895
|
+
}
|
|
823
896
|
async function exportFrames(movie, options = {}) {
|
|
824
897
|
const fmt = options.format ?? "mp4";
|
|
825
898
|
const eff = resolveRenderOptions(options);
|
|
826
899
|
const range2 = resolveRange(options.range, { frameRate: movie.frameRate, totalFrames: movie.totalFrames, duration: movie.duration, rows: typeof options.range === "string" ? movie.timelineData().rows : void 0 });
|
|
900
|
+
if (isAudioFormat(fmt)) return exportAudioOnly(movie, options, fmt, range2);
|
|
901
|
+
if (!["mp4", "mov", "webm", "mkv"].includes(fmt)) throw new Error(`pixi-effects: render({ format: "${String(fmt)}" }): use mp4, mov, webm, mkv (a picture) or wav, ogg (only the sound)`);
|
|
902
|
+
warnUnknownOptions("movie.render({ video })", options.video, ["codec", "bitrate", "hardware", "keyFrameInterval"]);
|
|
903
|
+
warnUnknownOptions("movie.render({ audio })", options.audio, ["codec", "bitrate"]);
|
|
904
|
+
const videoBitrate = bitrateOf(eff.bitrate ?? "high", QUALITY_HIGH);
|
|
827
905
|
const opts = {
|
|
828
906
|
format: fmt,
|
|
829
|
-
video: {
|
|
830
|
-
codec: options.video?.codec ?? VIDEO_CODEC_BY_FORMAT[fmt],
|
|
831
|
-
bitrate: qualityMap[eff.bitrate ?? "high"] ?? QUALITY_HIGH
|
|
832
|
-
},
|
|
907
|
+
video: { codec: "", bitrate: videoBitrate },
|
|
833
908
|
audio: {
|
|
834
|
-
codec: options.audio?.codec ??
|
|
835
|
-
bitrate:
|
|
909
|
+
codec: options.audio?.codec ?? (fmt === "mp4" || fmt === "mov" ? "aac" : "opus"),
|
|
910
|
+
bitrate: bitrateOf(options.audio?.bitrate, QUALITY_HIGH)
|
|
836
911
|
}
|
|
837
912
|
};
|
|
838
913
|
const container = makeOutputFormat(opts.format);
|
|
@@ -847,9 +922,23 @@ async function exportFrames(movie, options = {}) {
|
|
|
847
922
|
const blurCanvas = mb ? Object.assign(document.createElement("canvas"), { width: stage.width, height: stage.height }) : null;
|
|
848
923
|
const small = eff.scale < 1 ? Object.assign(document.createElement("canvas"), { width: Math.max(2, Math.round(stage.width * eff.scale / 2) * 2), height: Math.max(2, Math.round(stage.height * eff.scale / 2) * 2) }) : null;
|
|
849
924
|
const smallCtx = small?.getContext("2d") ?? null;
|
|
850
|
-
const
|
|
925
|
+
const picture = small ?? blurCanvas ?? stage;
|
|
926
|
+
const chosen = await chooseVideoCodec({
|
|
927
|
+
fmt,
|
|
928
|
+
requested: options.video?.codec,
|
|
929
|
+
supported: container.getSupportedVideoCodecs(),
|
|
930
|
+
canEncode: (c) => canEncodeVideo(c, { width: picture.width, height: picture.height, bitrate: opts.video.bitrate })
|
|
931
|
+
});
|
|
932
|
+
if (chosen.fellBackFrom) console.warn(`pixi-effects: this browser cannot encode ${chosen.fellBackFrom.toUpperCase()} video, so the ${fmt} carries ${chosen.codec.toUpperCase()} instead (name a codec with render({ video: { codec } }) to choose yourself).`);
|
|
933
|
+
opts.video.codec = chosen.codec;
|
|
934
|
+
const hardware = options.video?.hardware;
|
|
935
|
+
if (hardware !== void 0 && !["no-preference", "prefer-hardware", "prefer-software"].includes(hardware)) {
|
|
936
|
+
throw new Error(`pixi-effects: render({ video: { hardware: "${String(hardware)}" } }): use 'prefer-hardware', 'prefer-software' or 'no-preference'`);
|
|
937
|
+
}
|
|
938
|
+
const canvasSource = new CanvasSource(picture, {
|
|
851
939
|
codec: opts.video.codec,
|
|
852
|
-
bitrate: opts.video.bitrate
|
|
940
|
+
bitrate: opts.video.bitrate,
|
|
941
|
+
...hardware ? { hardwareAcceleration: hardware } : {}
|
|
853
942
|
});
|
|
854
943
|
output.addVideoTrack(canvasSource, { frameRate: movie.frameRate });
|
|
855
944
|
if (audio) {
|
|
@@ -865,7 +954,9 @@ async function exportFrames(movie, options = {}) {
|
|
|
865
954
|
await output.start();
|
|
866
955
|
}
|
|
867
956
|
movie.app.ticker.stop();
|
|
868
|
-
const
|
|
957
|
+
const interval = options.video?.keyFrameInterval ?? 2;
|
|
958
|
+
if (!(typeof interval === "number" && Number.isFinite(interval) && interval > 0)) throw new Error(`pixi-effects: render({ video: { keyFrameInterval: ${String(interval)} } }): seconds between keyframes, above 0 (default 2)`);
|
|
959
|
+
const keyframeIntervalFrames = Math.max(1, Math.round(interval * movie.frameRate));
|
|
869
960
|
try {
|
|
870
961
|
const count = Math.max(1, range2.toFrame - range2.fromFrame);
|
|
871
962
|
for (let frame = range2.fromFrame; frame <= range2.toFrame; frame++) {
|
|
@@ -2429,8 +2520,6 @@ function setLoaderProgress(loader, state) {
|
|
|
2429
2520
|
|
|
2430
2521
|
// src/core/Movie.ts
|
|
2431
2522
|
extensions.add(CullerPlugin);
|
|
2432
|
-
gsap.registerPlugin(PixiPlugin);
|
|
2433
|
-
PixiPlugin.registerPIXI(PIXI);
|
|
2434
2523
|
var Movie = class {
|
|
2435
2524
|
_events = {};
|
|
2436
2525
|
_initState = "idle";
|
|
@@ -2566,8 +2655,8 @@ var Movie = class {
|
|
|
2566
2655
|
this.stops = normalizeStops(options.composition?.stops, this.duration, this.frameRate);
|
|
2567
2656
|
this._posterFrame = poster.frame;
|
|
2568
2657
|
this.background = options.background ?? "#000000";
|
|
2569
|
-
this.timeline =
|
|
2570
|
-
this.timeline
|
|
2658
|
+
this.timeline = createTimeline({ paused: true, defaults: { ease: "none" } });
|
|
2659
|
+
lengthen(this.timeline, this.duration);
|
|
2571
2660
|
const baseAppOptions = {
|
|
2572
2661
|
width: this.width,
|
|
2573
2662
|
height: this.height,
|
|
@@ -2652,8 +2741,8 @@ var Movie = class {
|
|
|
2652
2741
|
if (this.audioBuffer) this._mixStats = limitMix(this.audioBuffer, audios);
|
|
2653
2742
|
}
|
|
2654
2743
|
this._audioSources = audios;
|
|
2655
|
-
this.timeline.progress(1).progress(0);
|
|
2656
2744
|
lp.begin("frames", 0);
|
|
2745
|
+
this.timeline.time(this._timeOf(0));
|
|
2657
2746
|
await this._awaitVideoFrames();
|
|
2658
2747
|
this._updateSpace();
|
|
2659
2748
|
this._renderNow();
|
|
@@ -3358,6 +3447,12 @@ function splitText(text, style = {}, opts = {}) {
|
|
|
3358
3447
|
return out;
|
|
3359
3448
|
}
|
|
3360
3449
|
|
|
3450
|
+
// src/presets/_ease.ts
|
|
3451
|
+
function parseEase2(name) {
|
|
3452
|
+
checkEase(name, "a preset");
|
|
3453
|
+
return parseEase(name);
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3361
3456
|
// src/presets/kenBurns.ts
|
|
3362
3457
|
var KEN_BURNS_KEYS = ["asset", "name", "at", "duration", "fit", "ease", "motion", "origin", "zoom", "direction", "angle", "from", "to"];
|
|
3363
3458
|
function kenBurns(opts) {
|
|
@@ -3470,10 +3565,6 @@ function kenBurns(opts) {
|
|
|
3470
3565
|
function clamp(v, lo, hi) {
|
|
3471
3566
|
return Math.max(lo, Math.min(hi, v));
|
|
3472
3567
|
}
|
|
3473
|
-
function parseEase(name) {
|
|
3474
|
-
checkEase(name, "a preset");
|
|
3475
|
-
return gsap.parseEase(name);
|
|
3476
|
-
}
|
|
3477
3568
|
|
|
3478
3569
|
// src/presets/orbit.ts
|
|
3479
3570
|
var ORBIT_KEYS = ["duration", "degrees", "start", "radius", "center", "width", "height", "fov", "ease", "dollyZoom", "at", "name", "stepsPerSecond"];
|
|
@@ -3497,8 +3588,8 @@ function orbit(opts) {
|
|
|
3497
3588
|
const fixedR = opts.radius ?? homeDistance(height, fov ?? DEFAULT_FOV);
|
|
3498
3589
|
const start = opts.start ?? -degrees / 2;
|
|
3499
3590
|
const steps = Math.max(1, Math.round(duration * stepsPerSecond));
|
|
3500
|
-
const easeFn =
|
|
3501
|
-
const dollyEase = dolly ?
|
|
3591
|
+
const easeFn = parseEase2(ease);
|
|
3592
|
+
const dollyEase = dolly ? parseEase2(dolly.ease ?? ease) : null;
|
|
3502
3593
|
const pos = (i) => {
|
|
3503
3594
|
const p = i / steps;
|
|
3504
3595
|
const a = (start + degrees * easeFn(p)) * DEG;
|
|
@@ -3668,7 +3759,7 @@ function followPath(opts) {
|
|
|
3668
3759
|
const t = Math.min(Math.max((s - g.start) / g.len, 0), 1);
|
|
3669
3760
|
return { x: g.x0 + (g.x1 - g.x0) * t, y: g.y0 + (g.y1 - g.y0) * t, heading: Math.atan2(g.y1 - g.y0, g.x1 - g.x0) * 180 / Math.PI };
|
|
3670
3761
|
};
|
|
3671
|
-
const shape =
|
|
3762
|
+
const shape = parseEase2(ease);
|
|
3672
3763
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3673
3764
|
let turn = 0;
|
|
3674
3765
|
const sample = (k) => {
|
|
@@ -3745,7 +3836,7 @@ function cameraPath(opts) {
|
|
|
3745
3836
|
const a = curve[i], b = curve[i + 1];
|
|
3746
3837
|
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
3747
3838
|
};
|
|
3748
|
-
const shape =
|
|
3839
|
+
const shape = parseEase2(ease);
|
|
3749
3840
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3750
3841
|
const sample = (k) => {
|
|
3751
3842
|
const p = from + (to - from) * shape(k / steps);
|
|
@@ -3787,7 +3878,7 @@ function stagger(items, options = {}) {
|
|
|
3787
3878
|
const dist2 = distances(n, from, grid, seed);
|
|
3788
3879
|
const max = dist2.reduce((m, d) => Math.max(m, d), 0);
|
|
3789
3880
|
const total = amount !== void 0 ? amount : (each ?? 0.1) * max;
|
|
3790
|
-
const shape =
|
|
3881
|
+
const shape = parseEase2(ease);
|
|
3791
3882
|
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
3792
3883
|
const delays = dist2.map((d) => max === 0 ? 0 : Math.round(total * clamp01(shape(d / max)) * 1e6) / 1e6);
|
|
3793
3884
|
if (isCount) return delays;
|
|
@@ -4332,6 +4423,6 @@ function withFade(spec, opts) {
|
|
|
4332
4423
|
return spec;
|
|
4333
4424
|
}
|
|
4334
4425
|
|
|
4335
|
-
export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, deck, dismissLoader, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, normalizeStops, orbit, particles, pictureStops, react, resolveLoader, splitText, stagger, wiggle, withFade };
|
|
4426
|
+
export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, deck, dismissLoader, parseEase2 as ease, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, normalizeStops, orbit, particles, pictureStops, react, resolveLoader, splitText, stagger, wiggle, withFade };
|
|
4336
4427
|
//# sourceMappingURL=index.js.map
|
|
4337
4428
|
//# sourceMappingURL=index.js.map
|