reacthub-pixitweenjs 0.3.0-alpha.3 → 0.3.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -16
- package/dist/components/AepComposition/AepAudioLayer.d.ts +6 -0
- package/dist/components/AepComposition/AepComposition.d.ts +2 -0
- package/dist/components/AepComposition/AudioPlaybackManager.d.ts +38 -0
- package/dist/components/AepComposition/index.d.ts +3 -0
- package/dist/components/AepComposition/model3d/Pixi3DModelLayer.d.ts +9 -0
- package/dist/components/AepComposition/model3d/ThreeOffscreenRenderer.d.ts +49 -0
- package/dist/components/AepComposition/model3d/framing.d.ts +30 -0
- package/dist/components/AepComposition/model3d/geometry.d.ts +27 -0
- package/dist/components/AepComposition/model3d/index.d.ts +14 -0
- package/dist/components/AepComposition/model3d/lighting.d.ts +40 -0
- package/dist/components/AepComposition/model3d/readiness.d.ts +17 -0
- package/dist/components/AepComposition/model3d/sampleModel3D.d.ts +40 -0
- package/dist/components/PixiAudioSprite/HowlerAudioSprite.d.ts +8 -2
- package/dist/components/PixiAudioSprite/PixiAudioSprite.d.ts +37 -1
- package/dist/components/PixiAudioSprite/index.d.ts +3 -0
- package/dist/components/PixiAudioSprite/useAudioVisualizer.d.ts +30 -15
- package/dist/components/PixiCaptionsTrack/PixiCaptionsTrack.d.ts +86 -0
- package/dist/components/PixiCaptionsTrack/index.d.ts +5 -0
- package/dist/components/PixiCaptionsTrack/useCaptionPlayhead.d.ts +31 -0
- package/dist/components/PixiCaptionsTrack/useCaptionStyles.d.ts +45 -0
- package/dist/components/PixiCaptionsTrack/useEmojiTextures.d.ts +8 -0
- package/dist/components/PixiImageSprite/PixiImageSprite.d.ts +17 -0
- package/dist/components/PixiSVGSprite/PixiSvgImageSprite.d.ts +35 -0
- package/dist/components/PixiSVGSprite/PixiSvgPathSprite.d.ts +10 -0
- package/dist/components/PixiSVGSprite/PixiSvgRawSprite.d.ts +30 -0
- package/dist/components/PixiSVGSprite/index.d.ts +4 -0
- package/dist/components/PixiSequence/PixiSequence.d.ts +29 -5
- package/dist/components/PixiTextSprite/PixiTextSplit.d.ts +1 -1
- package/dist/components/PixiTextSprite/PixiTextSprite.d.ts +25 -0
- package/dist/components/PixiThreeSprite/PixiThreeModelSprite.d.ts +23 -0
- package/dist/components/PixiThreeSprite/index.d.ts +2 -0
- package/dist/components/PixiVideoSprite/PixiVideoSprite.d.ts +26 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/constants/animation.d.ts +232 -0
- package/dist/constants/animationConstants.d.ts +90 -0
- package/dist/constants/elementNames.d.ts +4 -0
- package/dist/filters/animated-vfx/AnimatedVfxFilter.d.ts +19 -0
- package/dist/filters/animated-vfx/composeShader.d.ts +2 -0
- package/dist/filters/animated-vfx/index.d.ts +14 -0
- package/dist/filters/animated-vfx/registry/animatedVfxRegistry.d.ts +65 -0
- package/dist/filters/animated-vfx/registry/waveTearVariants.d.ts +14 -0
- package/dist/filters/animated-vfx/toStrength.d.ts +1 -0
- package/dist/filters/animated-vfx/types.d.ts +18 -0
- package/dist/filters/animatedVfxFilters.d.ts +1 -0
- package/dist/filters/blend-mode/createBlendCompositeFilter.d.ts +26 -0
- package/dist/filters/edge-feather/EdgeFeatherFilter.d.ts +19 -0
- package/dist/filters/plate-key/PlateKeyFilter.d.ts +29 -0
- package/dist/hocs/AbstractContainer.d.ts +5 -0
- package/dist/hocs/BorderMaskContainer.d.ts +23 -8
- package/dist/hocs/drawMaskShape.d.ts +6 -2
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/useBlendFilter.d.ts +17 -0
- package/dist/hooks/useDebouncedValue.d.ts +11 -0
- package/dist/hooks/useFontEpoch.d.ts +10 -0
- package/dist/hooks/usePixiAnimation.d.ts +24 -0
- package/dist/hooks/useSpriteFilters.d.ts +54 -12
- package/dist/hooks/useSvgTexture.d.ts +29 -0
- package/dist/hooks/video/useVideoLifecycle.d.ts +23 -0
- package/dist/hooks/video/useVideoTexture.d.ts +34 -0
- package/dist/hooks/video/useVideoTimelineSync.d.ts +24 -0
- package/dist/hooks/withEffectsHook.d.ts +326 -0
- package/dist/hooks/withFiltersHook.d.ts +104 -38
- package/dist/index.es.js +29296 -60769
- package/dist/index.umd.js +1367 -4362
- package/dist/providers/GsapPixieContextProvider.d.ts +7 -0
- package/dist/types/BaseProps.d.ts +41 -14
- package/dist/types/CropTypes.d.ts +12 -0
- package/dist/types/Effects.d.ts +674 -13
- package/dist/types/aep/asset.d.ts +7 -7
- package/dist/types/aep/camera.d.ts +64 -64
- package/dist/types/aep/composition.d.ts +1 -1
- package/dist/types/aep/effect.d.ts +2 -2
- package/dist/types/aep/layer.d.ts +11733 -6766
- package/dist/types/aep/light.d.ts +80 -80
- package/dist/types/aep/postFx.d.ts +2 -2
- package/dist/types/aep/text-animator.d.ts +6 -6
- package/dist/types/aep/transform.d.ts +14 -14
- package/dist/types/aep/transform3D.d.ts +18 -18
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/PixiSelector.d.ts +17 -0
- package/dist/utils/assetRefCount.d.ts +20 -0
- package/dist/utils/audio/audioRegistry.d.ts +51 -0
- package/dist/utils/audio/audioSync.d.ts +98 -0
- package/dist/utils/audio/gainEnvelope.d.ts +162 -0
- package/dist/utils/audio/useAudioRegistry.d.ts +10 -0
- package/dist/utils/blendMode.d.ts +21 -0
- package/dist/utils/captions/captionClock.d.ts +17 -0
- package/dist/utils/captions/captionDisplay.d.ts +57 -0
- package/dist/utils/captions/captionPose.d.ts +107 -0
- package/dist/utils/captions/captionVisual.d.ts +32 -0
- package/dist/utils/captions/captionWordLayout.d.ts +67 -0
- package/dist/utils/captions/groupSegments.d.ts +20 -0
- package/dist/utils/captions/index.d.ts +10 -0
- package/dist/utils/captions/parseSubtitles.d.ts +25 -0
- package/dist/utils/captions/sampleCaption.d.ts +25 -0
- package/dist/utils/captions/timeBase.d.ts +34 -0
- package/dist/utils/captions/types.d.ts +279 -0
- package/dist/utils/entranceOverlap.d.ts +37 -0
- package/dist/utils/fonts/fontLoader.d.ts +33 -0
- package/dist/utils/fonts/fontSpec.d.ts +16 -0
- package/dist/utils/fonts/googleFonts.d.ts +9 -0
- package/dist/utils/gifTiming.d.ts +22 -0
- package/dist/utils/gsapEffects/animationConfigs.d.ts +3802 -0
- package/dist/utils/gsapEffects/backEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/bounceEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/effectGenerator.d.ts +3 -0
- package/dist/utils/gsapEffects/effectTarget.d.ts +11 -0
- package/dist/utils/gsapEffects/fadeEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/flipEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/generalEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/index.d.ts +0 -0
- package/dist/utils/gsapEffects/lightSpeedEffect.d.ts +1 -0
- package/dist/utils/gsapEffects/logoRevealEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/registerEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/riseEffect.d.ts +1 -0
- package/dist/utils/gsapEffects/rollEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/rotateEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/slideEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/staggerTextEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/textUnitEffects.d.ts +1 -0
- package/dist/utils/gsapEffects/textUnitMask.d.ts +1 -0
- package/dist/utils/gsapEffects/textUnits.d.ts +172 -0
- package/dist/utils/gsapEffects/typewriterEffect.d.ts +1 -0
- package/dist/utils/gsapEffects/wipeEffect.d.ts +1 -0
- package/dist/utils/gsapEffects/zoomEffects.d.ts +1 -0
- package/dist/utils/index.d.ts +25 -0
- package/dist/utils/loadSpriteTexture.d.ts +33 -4
- package/dist/utils/sanitizeCanvasText.d.ts +12 -0
- package/dist/utils/sanitizeImageSrc.d.ts +7 -0
- package/dist/utils/svgRaster.d.ts +47 -0
- package/dist/utils/textLayout/index.d.ts +1 -1
- package/dist/utils/textLayout/layoutText.d.ts +5 -0
- package/dist/utils/textStyle.d.ts +81 -0
- package/dist/utils/textStyleV8.d.ts +62 -0
- package/dist/utils/threeModel.d.ts +55 -0
- package/dist/utils/videoAssetCache.d.ts +4 -0
- package/dist/utils/videoReadiness.d.ts +13 -0
- package/package.json +12 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* GSAP hands a registered effect its targets as an ARRAY — it runs
|
|
4
|
+
* gsap.utils.toArray() on whatever was passed to gsap.effects.NAME(...).
|
|
5
|
+
*
|
|
6
|
+
* Tween-only effects never notice, since gsap.to/from/set all accept arrays.
|
|
7
|
+
* Effects that touch the scene graph (addChild, getLocalBounds, mask) must
|
|
8
|
+
* unwrap first, or they fail on the Array — loudly with "addChild is not a
|
|
9
|
+
* function", or silently via `array.children ?? []` reading as empty.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveEffectNode(target: PIXI.Container | PIXI.Container[]): PIXI.Container | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
/** Normalised anchor, 0–1. `0,0` is top-left, `1,1` bottom-right. */
|
|
3
|
+
export type UnitAnchor = number | {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
export type TextEffectVars = {
|
|
8
|
+
duration?: number;
|
|
9
|
+
ease?: string;
|
|
10
|
+
immediateRender?: boolean;
|
|
11
|
+
overwrite?: boolean | 'auto';
|
|
12
|
+
x?: number;
|
|
13
|
+
y?: number;
|
|
14
|
+
alpha?: number;
|
|
15
|
+
scaleX?: number;
|
|
16
|
+
scaleY?: number;
|
|
17
|
+
revealUnit?: 'letter' | 'word';
|
|
18
|
+
/** Seconds between each unit's start. Maps to gsap's stagger `each`. */
|
|
19
|
+
stagger?: number;
|
|
20
|
+
/** Where the stagger emanates from: start | center | edges | random | end. */
|
|
21
|
+
staggerFrom?: 'start' | 'center' | 'edges' | 'random' | 'end';
|
|
22
|
+
/** Ease that distributes the start times (not the per-unit ease). */
|
|
23
|
+
staggerEase?: string;
|
|
24
|
+
/** Vertical travel for fade-y (px). */
|
|
25
|
+
yOffset?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Transform origins for the split, passed straight to SplitText.
|
|
29
|
+
*
|
|
30
|
+
* These are the ONLY correct way to set a unit's transform origin — `pivot`
|
|
31
|
+
* relocates the unit as well as re-centring it, which displaces it from the
|
|
32
|
+
* laid-out position captured in `baseX`/`baseY`.
|
|
33
|
+
*/
|
|
34
|
+
export type UnitAnchors = {
|
|
35
|
+
charAnchor?: UnitAnchor;
|
|
36
|
+
wordAnchor?: UnitAnchor;
|
|
37
|
+
lineAnchor?: UnitAnchor;
|
|
38
|
+
};
|
|
39
|
+
export type TextUnits = {
|
|
40
|
+
/** The effect's container — already normalised from GSAP's target array. */
|
|
41
|
+
node: PIXI.Container;
|
|
42
|
+
/** Words or chars, in reading order. */
|
|
43
|
+
units: PIXI.Container[];
|
|
44
|
+
/** Resting x of a unit, captured before any tween moved it. */
|
|
45
|
+
baseX: (unit: PIXI.Container) => number;
|
|
46
|
+
/** Resting y of a unit, captured before any tween moved it. */
|
|
47
|
+
baseY: (unit: PIXI.Container) => number;
|
|
48
|
+
/** Source text's font size, for deriving travel distances that scale. */
|
|
49
|
+
fontSize: number;
|
|
50
|
+
};
|
|
51
|
+
/** Depth-first search for the element's text node. */
|
|
52
|
+
export declare function findTextNode(root: PIXI.Container): PIXI.Text | null;
|
|
53
|
+
/** Normalise GSAP's target (always an array) to a Container, or null. */
|
|
54
|
+
export declare function resolveTextTarget(target: PIXI.Container | PIXI.Container[], label: string): PIXI.Container | null;
|
|
55
|
+
/**
|
|
56
|
+
* Lock the container to its authored transform before the units animate.
|
|
57
|
+
* Per-unit effects move the units, never the container, so it must sit at its
|
|
58
|
+
* resting state for the whole reveal.
|
|
59
|
+
*/
|
|
60
|
+
export declare function applyContainerBaseState(node: PIXI.Container, vars: TextEffectVars): void;
|
|
61
|
+
/**
|
|
62
|
+
* Cached split + resting positions, or null when the target has no PIXI.Text.
|
|
63
|
+
*
|
|
64
|
+
* A null return is a normal case, not an error: it is reached from project JSON
|
|
65
|
+
* and when an element's type changes under a saved animation. Callers should
|
|
66
|
+
* fall back to `containerFadeEffect`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveTextUnits(node: PIXI.Container, revealUnit: 'letter' | 'word', anchors?: UnitAnchors): TextUnits | null;
|
|
69
|
+
/**
|
|
70
|
+
* Turn the authored `stagger` into GSAP's config.
|
|
71
|
+
*
|
|
72
|
+
* `amount` is the total time spread across all units, so the LAST unit still
|
|
73
|
+
* lands on `duration` — the documented way to express what these effects used to
|
|
74
|
+
* hand-roll by offsetting N separate tweens. `each` would instead make the total
|
|
75
|
+
* grow with the word count, so a long title would overrun its own animation.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveStagger(vars: TextEffectVars, unitCount: number, duration: number): {
|
|
78
|
+
amount: number;
|
|
79
|
+
unitDuration: number;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The `stagger` object shared by every per-unit effect.
|
|
83
|
+
*
|
|
84
|
+
* `defaultFrom` lets an effect (e.g. TEXT_SPOTLIGHT → 'center') pick its own
|
|
85
|
+
* look when the user hasn't overridden it. Do NOT implement that by spreading
|
|
86
|
+
* `{ staggerFrom: defaultFrom, ...vars }` at the call site — `vars` always
|
|
87
|
+
* carries an explicit `staggerFrom` key (usePixiAnimation's `animInExtra` sets
|
|
88
|
+
* it even when the author never set one, so its value is `undefined`), and
|
|
89
|
+
* object spread copies that key regardless of value, silently clobbering the
|
|
90
|
+
* default. This shipped once already: every TEXT_* effect defaulted to
|
|
91
|
+
* 'start' instead of its intended origin until this comment was added.
|
|
92
|
+
*/
|
|
93
|
+
export declare function staggerConfig(vars: TextEffectVars, amount: number, defaultFrom?: NonNullable<TextEffectVars['staggerFrom']>): {
|
|
94
|
+
ease?: string | undefined;
|
|
95
|
+
amount: number;
|
|
96
|
+
from: NonNullable<"start" | "center" | "edges" | "random" | "end" | undefined>;
|
|
97
|
+
};
|
|
98
|
+
export declare function ensureUnitMask(unit: PIXI.Container, signature: string): PIXI.Graphics | null;
|
|
99
|
+
/**
|
|
100
|
+
* Public record of each per-unit effect's own defaults, keyed by name.
|
|
101
|
+
*
|
|
102
|
+
* Exists so `src/components/edit-menu/constants.ts` (`TEXT_ANIMATION_DEFAULT_FROM`)
|
|
103
|
+
* can be cross-checked against the real values rather than drifting silently —
|
|
104
|
+
* see `textUnitEffectsBehavior.test.ts`. Pure data; importing it does not
|
|
105
|
+
* invoke PIXI or run any effect.
|
|
106
|
+
*/
|
|
107
|
+
export declare const TEXT_UNIT_EFFECT_DEFAULTS: Readonly<Record<string, {
|
|
108
|
+
from: NonNullable<TextEffectVars['staggerFrom']>;
|
|
109
|
+
unit: 'letter' | 'word';
|
|
110
|
+
}>>;
|
|
111
|
+
export type UnitEffectContext = {
|
|
112
|
+
baseX: (unit: PIXI.Container) => number;
|
|
113
|
+
baseY: (unit: PIXI.Container) => number;
|
|
114
|
+
/**
|
|
115
|
+
* Resting box height per unit. Measured once per effect run and ONLY when
|
|
116
|
+
* the effect is masked — unmasked effects never pay for getLocalBounds.
|
|
117
|
+
* Falls back to fontSize (design-space units, NFR4).
|
|
118
|
+
*/
|
|
119
|
+
unitH: (unit: PIXI.Container) => number;
|
|
120
|
+
/** Source text's font size, for deriving travel distances that scale. */
|
|
121
|
+
fontSize: number;
|
|
122
|
+
};
|
|
123
|
+
export type UnitEffectSpec = {
|
|
124
|
+
/** GSAP effect name / ANIMATION id. */
|
|
125
|
+
name: string;
|
|
126
|
+
/** Default per-unit ease. */
|
|
127
|
+
ease: string;
|
|
128
|
+
/** Default stagger origin for this look. */
|
|
129
|
+
from?: TextEffectVars['staggerFrom'];
|
|
130
|
+
/** Default split granularity. `revealUnit` in the project JSON overrides it. */
|
|
131
|
+
unit?: 'letter' | 'word';
|
|
132
|
+
/** Transform origins — applied to the split, never as pivot. */
|
|
133
|
+
anchors?: UnitAnchors;
|
|
134
|
+
/**
|
|
135
|
+
* Clip every unit to its own resting box (FR8 masked reveals). The unit
|
|
136
|
+
* still animates through the same single fromTo — the mask only adds the
|
|
137
|
+
* hard edge, and pads past it so the resting frame is unclipped.
|
|
138
|
+
*/
|
|
139
|
+
masked?: boolean;
|
|
140
|
+
/** Per-unit start state. */
|
|
141
|
+
from_: (ctx: UnitEffectContext) => gsap.TweenVars;
|
|
142
|
+
/** Per-unit end state. Must land every unit exactly on its resting position. */
|
|
143
|
+
to: (ctx: UnitEffectContext) => gsap.TweenVars;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* The single registration path for every SplitText per-unit effect (phase 2
|
|
147
|
+
* catalogue in `textUnitEffects.ts`, masked FR8 catalogue in
|
|
148
|
+
* `textUnitMask.ts`). One `gsap.fromTo` over the split units with a native
|
|
149
|
+
* `stagger` config; splitting, caching, resting-position capture and stagger
|
|
150
|
+
* maths all live above in this module.
|
|
151
|
+
*
|
|
152
|
+
* Three rules shape every effect registered here:
|
|
153
|
+
*
|
|
154
|
+
* - Positions are ABSOLUTE. A recipe's `y: 50` means "50px from where it
|
|
155
|
+
* sits"; on a Pixi unit the same literal means "y = 50 in parent space",
|
|
156
|
+
* which stacks every word in one spot. Always tween relative to baseX/baseY.
|
|
157
|
+
* - Transform origin comes from `charAnchor`/`wordAnchor`, never `pivot` —
|
|
158
|
+
* `pivot` relocates the unit away from its captured resting position.
|
|
159
|
+
* - Randomness must be DETERMINISTIC per unit. usePixiAnimation rebuilds the
|
|
160
|
+
* timeline every frame, so `gsap.utils.random()` would re-roll ~30x a
|
|
161
|
+
* second and the text would jitter instead of animating.
|
|
162
|
+
*/
|
|
163
|
+
export declare function registerTextUnitEffect(spec: UnitEffectSpec): void;
|
|
164
|
+
/**
|
|
165
|
+
* Whole-element fade — the non-text form.
|
|
166
|
+
*
|
|
167
|
+
* A sprite has no sub-units to stagger, so this is a fade (plus an optional
|
|
168
|
+
* rise) over the container itself. It backs the generic STAGGER_FADE family for
|
|
169
|
+
* images, video and shapes, and is the safety net whenever a text effect is
|
|
170
|
+
* pointed at something with no PIXI.Text inside.
|
|
171
|
+
*/
|
|
172
|
+
export declare function containerFadeEffect(node: PIXI.Container, vars: TextEffectVars, withYOffset: boolean, defaultEase: string): gsap.core.Tween;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,3 +4,28 @@ export { areSpritePropsEqual, SPRITE_REF_PROP_NAMES, } from './areSpritePropsEqu
|
|
|
4
4
|
export { resolveTextRuns, resolveTextRunsWithWarnings, } from './text/resolveTextRuns';
|
|
5
5
|
export { layoutText, createCanvasMetricsProvider, MetricsCache, metricsCacheKey, splitGraphemes, isWhitespaceChar, type AepTextAlign as AepTextLayoutAlign, type AepGlyphMetrics, type AepTextLayoutGlyph, type AepTextLayoutInput, type AepTextLayoutLine, type AepTextLayoutResult, type AepTextLayoutRun, type AepTextMetricsProvider, } from './textLayout';
|
|
6
6
|
export { loadMsdfAtlas, hydrateMsdfAtlas, MSDF_VERTEX_SHADER, MSDF_FRAGMENT_SHADER, computeInstanceMatrix, writeInstanceColor, hexToRgba, type MsdfAtlas, type MsdfAtlasJson, type MsdfGlyph, type AnimatorOffset as MsdfAnimatorOffset, } from './msdf';
|
|
7
|
+
export * from './captions';
|
|
8
|
+
export { applyEntranceOverlaps } from './entranceOverlap';
|
|
9
|
+
export { ANIMATION, ANIMATION_TIMING, CANVAS_DEFAULTS, ANIMATIONS_WITHOUT_ALPHA, SPECIAL_ANIMATIONS, LOOP_ANIMATIONS, isLoopAnimation, camelToUpperSnake, normalizeAnimation, normalizeLoopAnimation, animationAffectsAlpha, isSpecialAnimation, isValidAnimation, } from '../constants/animation';
|
|
10
|
+
export { ANIMATION_CONFIGS } from './gsapEffects/animationConfigs';
|
|
11
|
+
export { useAllVideosReady, registerVideo, markVideoReady, unregisterVideo, resetVideoReadiness, } from './videoReadiness';
|
|
12
|
+
export { acquireVideoAsset, releaseVideoAsset } from './videoAssetCache';
|
|
13
|
+
export { getElementName, getUniqueIdFromName, findByName, findAllByPattern, createPixiSelector, type PixiSelector, } from './PixiSelector';
|
|
14
|
+
export { mapV7DropShadow, mapV7Stroke, buildV8FillGradient, normalizeFontWeight, normalizeLetterSpacing, } from './textStyleV8';
|
|
15
|
+
export { PIXITEXT_HITAREA_PREFIX, PIXITEXT_TEXT_LABEL, getPixiTextHitAreaName, } from '../constants/elementNames';
|
|
16
|
+
export { useBlendFilter } from '../hooks/useBlendFilter';
|
|
17
|
+
export { resolveBlendModeString, resolveBlendStrategy } from './blendMode';
|
|
18
|
+
export { sanitizeImageSrc } from './sanitizeImageSrc';
|
|
19
|
+
export { loadSpriteTextureSync, type SpriteTextureHandle, } from './loadSpriteTexture';
|
|
20
|
+
export { createAssetRefCounter, type AssetRefCounter } from './assetRefCount';
|
|
21
|
+
export { gifFrameAt, type GifFrameTiming } from './gifTiming';
|
|
22
|
+
export { buildRasterSvg, rewriteSvg, readOriginalSize, detectOutlineIcon, isSvgSource, } from './svgRaster';
|
|
23
|
+
export { loadGoogleFonts, getLoadedFonts, FONT_LOAD_TIMEOUT_MS, type FontsLoadedDetail, } from './fonts/fontLoader';
|
|
24
|
+
export { fontFamilyKey, formatGoogleFamily, fontWeightsOf, isFontSpecCovered, googleFontsHref, } from './fonts/fontSpec';
|
|
25
|
+
export { GOOGLE_FONTS, ALL_GOOGLE_FONTS, PRELOAD_FONTS } from './fonts/googleFonts';
|
|
26
|
+
export { sanitizeCanvasText, CANVAS_TEXT_MAX_LENGTH } from './sanitizeCanvasText';
|
|
27
|
+
export { buildTextStyleOptions, type TextStyleInput } from './textStyle';
|
|
28
|
+
export { gainAt, fadeGainAt, duckGainAt, buildGainSpec, deriveDuckWindows, duckWindowsFromEnvelope, dbToLinear, linearToDb, DEFAULT_DUCK_TO, DEFAULT_DUCK_FADE_SEC, MUSIC_BED_DEFAULT_VOLUME, VOICE_TRACK_ROLES, type AudioFade, type AudioFadeSide, type DuckWindow, type GainSpec, } from './audio/gainEnvelope';
|
|
29
|
+
export { decideAudioSync, applyAudioDecision, clipFileTime, clipVolumeAt, DRIFT_TOLERANCE_SEC, type AudioClipSpec, type SyncDecision, } from './audio/audioSync';
|
|
30
|
+
export { audioRegistry, createAudioRegistry, type AudioRegistry, } from './audio/audioRegistry';
|
|
31
|
+
export * from './threeModel';
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import * as PIXI from
|
|
1
|
+
import * as PIXI from "pixi.js";
|
|
2
2
|
export interface LoadSpriteTextureOptions {
|
|
3
|
-
scaleMode?:
|
|
3
|
+
scaleMode?: "linear" | "nearest";
|
|
4
4
|
enableMipmap?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Force Pixi's texture loader. Default true.
|
|
7
|
+
*
|
|
8
|
+
* Extensionless image URLs (Unsplash/imgix: `/photo-xxx?fm=jpg&w=1080`) give Pixi's
|
|
9
|
+
* resolver nothing to infer a loader from, so `Assets.load(url)` silently never resolves
|
|
10
|
+
* and the canvas stays blank. Pass `false` for GIF/video/SVG URLs that must go through
|
|
11
|
+
* their own parser.
|
|
12
|
+
*/
|
|
13
|
+
forceTextureParser?: boolean;
|
|
5
14
|
}
|
|
6
|
-
export
|
|
15
|
+
export interface SpriteTextureHandle {
|
|
7
16
|
promise: Promise<PIXI.Texture | null>;
|
|
17
|
+
/** Stop caring about the result (resolves the promise with null if still pending). */
|
|
8
18
|
cancel: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Release this handle's use of the texture. The texture belongs to `PIXI.Assets` (every URL,
|
|
21
|
+
* relative or absolute, is cached there), so it is never `destroy`ed: `Assets.unload` runs
|
|
22
|
+
* once no sprite has used the URL for a grace period.
|
|
23
|
+
*/
|
|
9
24
|
dispose: () => void;
|
|
10
|
-
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Load a texture and return a handle SYNCHRONOUSLY.
|
|
28
|
+
*
|
|
29
|
+
* The old version was `async` and returned `Promise<handle>`, so a component that unmounted
|
|
30
|
+
* before that promise settled ran its cleanup with no handle to cancel: the load completed
|
|
31
|
+
* later and called `setTexture` on an unmounted component. Returning the handle directly
|
|
32
|
+
* removes the race. `loadSpriteTexture(src).then(handle => ...)` still works (see below).
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadSpriteTextureSync(rawSrc: string, opts?: LoadSpriteTextureOptions): SpriteTextureHandle;
|
|
35
|
+
/**
|
|
36
|
+
* Backward-compatible wrapper: resolves to the same handle. Prefer
|
|
37
|
+
* `loadSpriteTextureSync`, which has no cancel race.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadSpriteTexture(src: string, opts?: LoadSpriteTextureOptions): Promise<SpriteTextureHandle>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitize plain text for in-canvas title / TipTap editing.
|
|
3
|
+
*
|
|
4
|
+
* Guards against paste of HTML, control chars, zero-width/bidi tricks,
|
|
5
|
+
* and unbounded length that would blow up Pixi Text layout or project JSON.
|
|
6
|
+
*/
|
|
7
|
+
/** Soft cap for a single title element — enough for multi-line copy, not novels. */
|
|
8
|
+
export declare const CANVAS_TEXT_MAX_LENGTH = 2000;
|
|
9
|
+
/**
|
|
10
|
+
* Normalize and harden plain text before it hits TipTap / Pixi / editor store.
|
|
11
|
+
*/
|
|
12
|
+
export declare const sanitizeCanvasText: (input: unknown, maxLen?: number) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repairs a `data:` URI that had a CDN origin wrongly prepended, e.g.
|
|
3
|
+
* https://x.cloudfront.net/data:image/png;base64,AAAA?Expires=... -> data:image/png;base64,AAAA
|
|
4
|
+
* and drops the signed-URL query params appended after the payload. Anything else is
|
|
5
|
+
* returned unchanged. Ported from the Clippy editor.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sanitizeImageSrc(src: string | undefined | null): string | undefined | null;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const BASE_STROKE_WIDTH_SVG = 2;
|
|
2
|
+
/** Longest side of the SVG's own coordinate system (viewBox, else width/height, else 512). */
|
|
3
|
+
export declare const readOriginalSize: (svgEl: Element) => number;
|
|
4
|
+
/** Outline (stroke-based) icons need `meet` scaling and stroke handling; filled ones stretch. */
|
|
5
|
+
export declare const detectOutlineIcon: (svgEl: Element) => boolean;
|
|
6
|
+
export declare const computeStrokeWidth: ({ shouldApply, strokeWidth, resolution, renderWidth, renderHeight, originalSize, isOutline, }: {
|
|
7
|
+
shouldApply: boolean;
|
|
8
|
+
strokeWidth: number;
|
|
9
|
+
resolution: number;
|
|
10
|
+
renderWidth: number;
|
|
11
|
+
renderHeight: number;
|
|
12
|
+
originalSize: number;
|
|
13
|
+
isOutline: boolean;
|
|
14
|
+
}) => number;
|
|
15
|
+
export declare const applyStrokeToShapes: (svgEl: Element, stroke: string, strokeWidth: number) => void;
|
|
16
|
+
export declare const scaleExistingStrokes: (svgEl: Element, scale: number, minStroke: number, resolution: number, originalSize: number, renderSize: number) => void;
|
|
17
|
+
export interface BuildRasterSvgOptions {
|
|
18
|
+
/** Target size in CSS px (before `resolution`). Falls back to the SVG's own size. */
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
resolution: number;
|
|
22
|
+
stroke?: string;
|
|
23
|
+
strokeWidth?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Re-write an SVG so that drawing it onto a `width*res x height*res` canvas is crisp and
|
|
27
|
+
* its strokes scale sensibly. Returns the serialized SVG. Non-SVG documents are returned as is.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildRasterSvg(svgText: string, opts: BuildRasterSvgOptions): string;
|
|
30
|
+
export interface RewriteSvgOptions {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
fill?: string;
|
|
34
|
+
stroke?: string;
|
|
35
|
+
strokeWidth?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Size an SVG for baking through `Graphics.svg()` and optionally override fill/stroke on the
|
|
39
|
+
* root element (paths that inherit pick it up; per-path fills and gradients are left alone).
|
|
40
|
+
*
|
|
41
|
+
* Fix vs Clippy: it forced `viewBox="0 0 w h"`, discarding the artwork's real viewBox and
|
|
42
|
+
* distorting non-square art. The original viewBox is kept; one is only synthesised when the
|
|
43
|
+
* document has none.
|
|
44
|
+
*/
|
|
45
|
+
export declare function rewriteSvg(svgText: string, opts: RewriteSvgOptions): string;
|
|
46
|
+
/** True for `.svg` URLs and inline `data:image/svg+xml` sources. */
|
|
47
|
+
export declare const isSvgSource: (src: string) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AepTextAlign, AepGlyphMetrics, AepTextLayoutGlyph, AepTextLayoutInput, AepTextLayoutLine, AepTextLayoutResult, AepTextLayoutRun, AepTextMetricsProvider, } from './types';
|
|
2
|
-
export { layoutText } from './layoutText';
|
|
2
|
+
export { layoutText, resetDefaultTextMetrics } from './layoutText';
|
|
3
3
|
export { createCanvasMetricsProvider, type CanvasMetricsProviderOptions, } from './canvasMetricsProvider';
|
|
4
4
|
export { createPixiCanvasMetricsProvider, type PixiCanvasMetricsProviderOptions, } from './pixiCanvasMetricsProvider';
|
|
5
5
|
export { createTypefaceMetricsProvider, type ThreeTypefaceJson, } from './typefaceMetricsProvider';
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { AepTextLayoutInput, AepTextLayoutResult } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Drop the default provider and its glyph-metrics cache. Call after webfonts finish loading:
|
|
4
|
+
* glyphs measured against the fallback font are otherwise cached and stay wrong.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resetDefaultTextMetrics(): void;
|
|
2
7
|
export declare function layoutText(input: AepTextLayoutInput): AepTextLayoutResult;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type * as PIXI from "pixi.js";
|
|
2
|
+
/** Everything the flat text sprite reads from `transformation` that shapes the TextStyle. */
|
|
3
|
+
export interface TextStyleInput {
|
|
4
|
+
fontFamily?: string;
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
fontWeight?: string | number;
|
|
7
|
+
fontStyle?: string;
|
|
8
|
+
/** `"small-caps"`, or (legacy) a boolean. */
|
|
9
|
+
fontVariant?: string | boolean;
|
|
10
|
+
fill?: string | number;
|
|
11
|
+
/** Two or more colours -> a linear FillGradient (overrides `fill`). */
|
|
12
|
+
gradientColors?: (string | number)[];
|
|
13
|
+
gradientStops?: number[];
|
|
14
|
+
/** 0 = vertical (default), 1 = horizontal. */
|
|
15
|
+
gradientType?: 0 | 1;
|
|
16
|
+
stroke?: string | number | object | null;
|
|
17
|
+
/** v8 name. */
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
/** v7 name; both are accepted. */
|
|
20
|
+
strokeThickness?: number;
|
|
21
|
+
dropShadow?: boolean | object;
|
|
22
|
+
dropShadowColor?: string | number | null;
|
|
23
|
+
dropShadowBlur?: number;
|
|
24
|
+
dropShadowAlpha?: number;
|
|
25
|
+
/** Radians. */
|
|
26
|
+
dropShadowAngle?: number;
|
|
27
|
+
dropShadowDistance?: number;
|
|
28
|
+
/** Soft-glow preset: a zero-offset shadow of `blurRadius`. Wins over `dropShadow`. */
|
|
29
|
+
blurEnabled?: boolean;
|
|
30
|
+
blurRadius?: number;
|
|
31
|
+
align?: string;
|
|
32
|
+
padding?: number;
|
|
33
|
+
letterSpacing?: number | string;
|
|
34
|
+
leading?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Wrap width in px. When unset the text does NOT wrap (a very large width), which is the
|
|
37
|
+
* sprite's long-standing default; set it (or call `setWordWrap`) to wrap.
|
|
38
|
+
*/
|
|
39
|
+
wordWrapWidth?: number;
|
|
40
|
+
/** Pixi v8.16+ tagged text. */
|
|
41
|
+
tagStyles?: Record<string, Partial<PIXI.TextStyleOptions>>;
|
|
42
|
+
}
|
|
43
|
+
export declare const NO_WRAP_WIDTH = 50000000;
|
|
44
|
+
/**
|
|
45
|
+
* Build Pixi v8 `TextStyleOptions` from the sprite's transformation fields. Pure (the only Pixi
|
|
46
|
+
* thing it may construct is a FillGradient), so it is unit-testable.
|
|
47
|
+
*
|
|
48
|
+
* Fixes over the previous inline builder:
|
|
49
|
+
* - font weights 400-900 were silently dropped (only bold/bolder/lighter/100-300 passed)
|
|
50
|
+
* - stroke/shadow went through the v7 flat props, which Pixi converts with a deprecation
|
|
51
|
+
* warning on every `new TextStyle`; v8 objects are emitted directly
|
|
52
|
+
* - a numeric black stroke (0x000000) was treated as "no stroke"
|
|
53
|
+
* - shadow alpha/angle/distance were hard-coded (alpha ignored, angle 30deg, distance 5)
|
|
54
|
+
* - negative letterSpacing was dropped
|
|
55
|
+
* - `fontVariant` was passed as a boolean
|
|
56
|
+
* - `align` and `padding` were never applied
|
|
57
|
+
* - gradient fills and `'transparent'` fills were unsupported
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildTextStyleOptions(input: TextStyleInput): PIXI.TextStyleOptions;
|
|
60
|
+
/**
|
|
61
|
+
* Where a background box sits so it hugs text of size `textW x textH` placed with `anchor` at
|
|
62
|
+
* (x, y), padded by `pad` on every side. Returns the box size and its position for a sprite
|
|
63
|
+
* that uses the SAME anchor as the text.
|
|
64
|
+
*/
|
|
65
|
+
export declare function hugBox(x: number, y: number, anchor: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}, textW: number, textH: number, pad: number): {
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
};
|
|
74
|
+
/** Normalise the scalar-or-point anchor. */
|
|
75
|
+
export declare const toAnchorPoint: (a: number | {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
} | undefined) => {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as PIXI from "pixi.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pixi v8 TextStyle helpers. v7 accepted flat `dropShadow*` / `strokeThickness`
|
|
4
|
+
* props; v8 expects `dropShadow: {…}`, `stroke: {color, width}` and a
|
|
5
|
+
* `FillGradient`. Pixi 8.18 still converts the flat v7 props in the constructor,
|
|
6
|
+
* but logs a deprecation warning on every `new TextStyle` — these helpers emit
|
|
7
|
+
* the v8 shapes directly. Ported from the Clippy editor, with fixes noted below.
|
|
8
|
+
*/
|
|
9
|
+
export interface V7DropShadowFields {
|
|
10
|
+
dropShadow?: boolean | object;
|
|
11
|
+
dropShadowColor?: string | number;
|
|
12
|
+
dropShadowBlur?: number;
|
|
13
|
+
dropShadowAlpha?: number;
|
|
14
|
+
dropShadowAngle?: number;
|
|
15
|
+
dropShadowDistance?: number;
|
|
16
|
+
}
|
|
17
|
+
export type V8DropShadowPatch = {
|
|
18
|
+
dropShadow?: {
|
|
19
|
+
color: string | number;
|
|
20
|
+
alpha: number;
|
|
21
|
+
angle: number;
|
|
22
|
+
blur: number;
|
|
23
|
+
distance: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const mapV7DropShadow: (s: V7DropShadowFields) => V8DropShadowPatch;
|
|
27
|
+
export interface V7StrokeFields {
|
|
28
|
+
stroke?: string | number | object | null;
|
|
29
|
+
strokeThickness?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Pack v7 `stroke` (colour) + `strokeThickness` (width) into the v8 object.
|
|
33
|
+
*
|
|
34
|
+
* Fix vs Clippy: a numeric black stroke (`0x000000`) is a valid colour but falsy,
|
|
35
|
+
* so test for null/undefined rather than truthiness.
|
|
36
|
+
*/
|
|
37
|
+
export declare const mapV7Stroke: (s: V7StrokeFields) => {
|
|
38
|
+
stroke?: object;
|
|
39
|
+
};
|
|
40
|
+
export interface V7GradientFields {
|
|
41
|
+
fillGradientStops?: number[];
|
|
42
|
+
fillGradientType?: 0 | 1;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build a v8 `FillGradient` from colours + stops. `type` 0 = vertical, 1 = horizontal.
|
|
46
|
+
* Returns undefined when fewer than two colours are given.
|
|
47
|
+
*
|
|
48
|
+
* Fix vs Clippy: uses the options form (`{type, start, end, textureSpace, colorStops}`);
|
|
49
|
+
* the positional `new FillGradient(x0, y0, x1, y1)` is deprecated since Pixi 8.5.2.
|
|
50
|
+
*/
|
|
51
|
+
export declare const buildV8FillGradient: (colorsHex: (string | number)[] | null | undefined, stops: number[] | undefined, type: 0 | 1 | undefined) => PIXI.FillGradient | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Normalise a CSS font weight. Accepts the named weights and 100..900 as a number
|
|
54
|
+
* or numeric string. Returns undefined for anything else, so the caller can leave
|
|
55
|
+
* the TextStyle default alone.
|
|
56
|
+
*
|
|
57
|
+
* Fix: the previous flat sprite only let `bold|bolder|lighter|100|200|300` through,
|
|
58
|
+
* silently dropping 400-900 (so Montserrat 800 rendered at 400).
|
|
59
|
+
*/
|
|
60
|
+
export declare const normalizeFontWeight: (weight: string | number | null | undefined) => PIXI.TextStyleFontWeight | undefined;
|
|
61
|
+
/** Letter spacing: any finite number, including negative (tight tracking). 0/invalid -> undefined. */
|
|
62
|
+
export declare const normalizeLetterSpacing: (value: number | string | null | undefined) => number | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export interface ThreeDParams {
|
|
3
|
+
positionX?: number;
|
|
4
|
+
positionY?: number;
|
|
5
|
+
positionZ?: number;
|
|
6
|
+
rotationX?: number;
|
|
7
|
+
rotationY?: number;
|
|
8
|
+
rotationZ?: number;
|
|
9
|
+
/** Continuous Y spin in rad/s, added on top of rotationY. Default 0.5. */
|
|
10
|
+
spinSpeed?: number;
|
|
11
|
+
scale?: number;
|
|
12
|
+
flipX?: 1 | -1;
|
|
13
|
+
flipY?: 1 | -1;
|
|
14
|
+
materialColor?: string;
|
|
15
|
+
roughness?: number;
|
|
16
|
+
metalness?: number;
|
|
17
|
+
emissiveIntensity?: number;
|
|
18
|
+
ambientIntensity?: number;
|
|
19
|
+
directionalIntensity?: number;
|
|
20
|
+
fillIntensity?: number;
|
|
21
|
+
clipIndex?: number;
|
|
22
|
+
playbackSpeed?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ModelPose {
|
|
25
|
+
position: [number, number, number];
|
|
26
|
+
rotation: [number, number, number];
|
|
27
|
+
scale: [number, number, number];
|
|
28
|
+
}
|
|
29
|
+
export declare const THREE_DEFAULTS: {
|
|
30
|
+
readonly ambientIntensity: 0.6;
|
|
31
|
+
readonly directionalIntensity: 1.2;
|
|
32
|
+
readonly fillIntensity: 0.8;
|
|
33
|
+
readonly spinSpeed: 0.5;
|
|
34
|
+
readonly playbackSpeed: 1;
|
|
35
|
+
};
|
|
36
|
+
/** Pure pose at local clip time `t` (seconds). Same input -> same output, so scrub/export are stable. */
|
|
37
|
+
export declare function computeModelPose(td: ThreeDParams, t: number): ModelPose;
|
|
38
|
+
/** Animation clock position for clip playback: speed-scaled, looped. */
|
|
39
|
+
export declare function clipTimeAt(t: number, duration: number, speed?: number, loop?: boolean): number;
|
|
40
|
+
export type MaterialOverrides = Pick<ThreeDParams, "materialColor" | "roughness" | "metalness" | "emissiveIntensity">;
|
|
41
|
+
export declare function hasMaterialOverrides(o: MaterialOverrides): boolean;
|
|
42
|
+
export declare function applyMaterialOverrides(root: THREE.Object3D, o: MaterialOverrides): void;
|
|
43
|
+
/** Stable key so overrides are re-applied only when they actually change. */
|
|
44
|
+
export declare function materialOverrideKey(o: MaterialOverrides): string;
|
|
45
|
+
/** Camera distance so a bounding box of `maxDim` fits the vertical FOV (degrees), with margin. */
|
|
46
|
+
export declare function fitDistance(maxDim: number, fovDeg: number, margin?: number): number;
|
|
47
|
+
export declare function fitCameraToObject(camera: THREE.PerspectiveCamera, root: THREE.Object3D, margin?: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* GLTFLoader resolves relative texture/buffer paths against the model's own directory. For hosts
|
|
50
|
+
* (e.g. Poly Haven) whose CDN layout doesn't mirror those paths, `resources` maps each relative
|
|
51
|
+
* path to its real absolute URL. Returns a URL modifier for THREE.LoadingManager, or undefined.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildResourceUrlModifier(modelSrc: string, resources?: Record<string, string>): ((url: string) => string) | undefined;
|
|
54
|
+
/** Recursively dispose geometries, materials and their textures. */
|
|
55
|
+
export declare function disposeObject(root: THREE.Object3D): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Mark the URL in use; cancels a pending unload so a remount keeps the texture. */
|
|
2
|
+
export declare const acquireVideoAsset: (key: string) => void;
|
|
3
|
+
/** Release one use; the texture is unloaded after the grace period if still unused. */
|
|
4
|
+
export declare const releaseVideoAsset: (key: string) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Failsafe: never block the play button longer than 5s on a hung load. */
|
|
2
|
+
export declare const VIDEO_READY_TIMEOUT_MS = 5000;
|
|
3
|
+
/**
|
|
4
|
+
* Register a video sprite as pending. Always re-pends on (re)mount so a remount
|
|
5
|
+
* after an earlier markVideoReady still waits for a fresh load signal.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerVideo(uniqueId: string): void;
|
|
8
|
+
export declare function markVideoReady(uniqueId: string): void;
|
|
9
|
+
export declare function unregisterVideo(uniqueId: string): void;
|
|
10
|
+
/** Clear all readiness state (project switch / editor reset). */
|
|
11
|
+
export declare function resetVideoReadiness(): void;
|
|
12
|
+
/** true when no registered video is still loading. */
|
|
13
|
+
export declare function useAllVideosReady(): boolean;
|