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,90 @@
|
|
|
1
|
+
export declare const ANIMATION_DIRECTION: {
|
|
2
|
+
IN: string;
|
|
3
|
+
OUT: string;
|
|
4
|
+
ATTENTION: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const ANIMATION_CATEGORY: {
|
|
7
|
+
NONE: string;
|
|
8
|
+
FADE: string;
|
|
9
|
+
SLIDE: string;
|
|
10
|
+
ZOOM: string;
|
|
11
|
+
BOUNCE: string;
|
|
12
|
+
BACK: string;
|
|
13
|
+
FLIP: string;
|
|
14
|
+
ROTATE: string;
|
|
15
|
+
ROLL: string;
|
|
16
|
+
LIGHT_SPEED: string;
|
|
17
|
+
WIPE: string;
|
|
18
|
+
SHAKE: string;
|
|
19
|
+
SPECIAL: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const ANIMATION_DEFAULTS: {
|
|
22
|
+
OFFSET_SMALL: number;
|
|
23
|
+
OFFSET_MEDIUM: number;
|
|
24
|
+
OFFSET_LARGE: number;
|
|
25
|
+
DEFAULT_DURATION: number;
|
|
26
|
+
MIN_DURATION: number;
|
|
27
|
+
MAX_DURATION: number;
|
|
28
|
+
OPACITY_HIDDEN: number;
|
|
29
|
+
OPACITY_PARTIAL: number;
|
|
30
|
+
OPACITY_VISIBLE: number;
|
|
31
|
+
SCALE_HIDDEN: number;
|
|
32
|
+
SCALE_SMALL: number;
|
|
33
|
+
SCALE_NORMAL: number;
|
|
34
|
+
SCALE_LARGE: number;
|
|
35
|
+
ROTATION_NONE: number;
|
|
36
|
+
ROTATION_SMALL: number;
|
|
37
|
+
ROTATION_MEDIUM: number;
|
|
38
|
+
ROTATION_LARGE: number;
|
|
39
|
+
ROTATION_FULL: number;
|
|
40
|
+
};
|
|
41
|
+
export declare const EASING_PRESETS: {
|
|
42
|
+
EASE_IN_OUT: string;
|
|
43
|
+
EASE_OUT: string;
|
|
44
|
+
EASE_IN: string;
|
|
45
|
+
EASE_OUT_STRONG: string;
|
|
46
|
+
EASE_IN_STRONG: string;
|
|
47
|
+
BOUNCE_OUT: string;
|
|
48
|
+
BOUNCE_IN: string;
|
|
49
|
+
ELASTIC_OUT: string;
|
|
50
|
+
BACK_OUT: string;
|
|
51
|
+
BACK_IN: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const BEZIER_CURVES: {
|
|
54
|
+
EASE_IN_OUT: number[];
|
|
55
|
+
EASE_OUT: number[];
|
|
56
|
+
EASE_IN: number[];
|
|
57
|
+
BOUNCE: number[];
|
|
58
|
+
SMOOTH: number[];
|
|
59
|
+
ZOOM_OUT: number[];
|
|
60
|
+
ZOOM_IN: number[];
|
|
61
|
+
};
|
|
62
|
+
export declare const SPRING_CONFIG: {
|
|
63
|
+
DEFAULT: {
|
|
64
|
+
damping: number;
|
|
65
|
+
stiffness: number;
|
|
66
|
+
mass: number;
|
|
67
|
+
};
|
|
68
|
+
BOUNCY: {
|
|
69
|
+
damping: number;
|
|
70
|
+
stiffness: number;
|
|
71
|
+
mass: number;
|
|
72
|
+
};
|
|
73
|
+
SMOOTH: {
|
|
74
|
+
damping: number;
|
|
75
|
+
stiffness: number;
|
|
76
|
+
mass: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export declare const KEYFRAME_PRESETS: {
|
|
80
|
+
BOUNCE_IN: number[];
|
|
81
|
+
BOUNCE_IN_VALUES: number[];
|
|
82
|
+
SHAKE: number[];
|
|
83
|
+
SHAKE_VALUES: number[];
|
|
84
|
+
HEARTBEAT: number[];
|
|
85
|
+
HEARTBEAT_VALUES: number[];
|
|
86
|
+
PULSE: number[];
|
|
87
|
+
PULSE_VALUES: number[];
|
|
88
|
+
};
|
|
89
|
+
export declare function getAnimationDirection(animationName: string): string | null;
|
|
90
|
+
export declare function getAnimationCategory(animationName: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const PIXITEXT_HITAREA_PREFIX = "pixitext-hitarea";
|
|
2
|
+
export declare const getPixiTextHitAreaName: (uniqueId: string) => string;
|
|
3
|
+
/** Label of the PIXI.Text node inside PixiTextSprite, for `getChildByLabel(label, true)`. */
|
|
4
|
+
export declare const PIXITEXT_TEXT_LABEL = "pixitext-text";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Filter } from 'pixi.js';
|
|
2
|
+
import { CreateAnimatedVfxFilterOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Generic time-driven VFX filter.
|
|
5
|
+
*
|
|
6
|
+
* `useSpriteFilters` advances `.time` for every filter with `__vfxAnimated`.
|
|
7
|
+
* Keep this contract stable so editor preview, scrubbing, and Remotion export
|
|
8
|
+
* all use the same deterministic timeline clock.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AnimatedVfxFilter extends Filter {
|
|
11
|
+
readonly __vfxAnimated = true;
|
|
12
|
+
private vfx;
|
|
13
|
+
constructor({ fragment, name, intensity, uniforms }: CreateAnimatedVfxFilterOptions);
|
|
14
|
+
apply(filterManager: any, input: any, output: any, clearMode: any): void;
|
|
15
|
+
get time(): number;
|
|
16
|
+
set time(value: number);
|
|
17
|
+
get intensity(): number;
|
|
18
|
+
set intensity(value: number);
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { AnimatedVfxFilter } from './AnimatedVfxFilter';
|
|
2
|
+
export { animatedVfxRegistry, isAnimatedVfxEffectName, type AnimatedVfxEffectName, } from './registry/animatedVfxRegistry';
|
|
3
|
+
export declare const createVhsFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
4
|
+
export declare const createGlitchWaveFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
5
|
+
export declare const createLightLeakFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
6
|
+
export declare const createFilmGrainFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
7
|
+
export declare const createChromaticWaveFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
8
|
+
export declare const createLiquidGlassFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
9
|
+
export declare const createBrokenGlassFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
10
|
+
export declare const createComicFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
11
|
+
export declare const createWaveTearDownFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
12
|
+
export declare const createWaveTearUpFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
13
|
+
export declare const createWaveTearAcrossFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
14
|
+
export declare const createWaveBrushFilter: (intensity?: number) => import('./AnimatedVfxFilter').AnimatedVfxFilter;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AnimatedVfxFilter } from '../AnimatedVfxFilter';
|
|
2
|
+
export declare const animatedVfxRegistry: {
|
|
3
|
+
VHS: {
|
|
4
|
+
shaderName: string;
|
|
5
|
+
defaultIntensity: number;
|
|
6
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
7
|
+
};
|
|
8
|
+
GlitchWave: {
|
|
9
|
+
shaderName: string;
|
|
10
|
+
defaultIntensity: number;
|
|
11
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
12
|
+
};
|
|
13
|
+
LightLeak: {
|
|
14
|
+
shaderName: string;
|
|
15
|
+
defaultIntensity: number;
|
|
16
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
17
|
+
};
|
|
18
|
+
FilmGrain: {
|
|
19
|
+
shaderName: string;
|
|
20
|
+
defaultIntensity: number;
|
|
21
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
22
|
+
};
|
|
23
|
+
ChromaticWave: {
|
|
24
|
+
shaderName: string;
|
|
25
|
+
defaultIntensity: number;
|
|
26
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
27
|
+
};
|
|
28
|
+
LiquidGlass: {
|
|
29
|
+
shaderName: string;
|
|
30
|
+
defaultIntensity: number;
|
|
31
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
32
|
+
};
|
|
33
|
+
BrokenGlass: {
|
|
34
|
+
shaderName: string;
|
|
35
|
+
defaultIntensity: number;
|
|
36
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
37
|
+
};
|
|
38
|
+
Comic: {
|
|
39
|
+
shaderName: string;
|
|
40
|
+
defaultIntensity: number;
|
|
41
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
42
|
+
};
|
|
43
|
+
WaveTearDown: {
|
|
44
|
+
shaderName: "vfx-wave-tear-down";
|
|
45
|
+
defaultIntensity: number;
|
|
46
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
47
|
+
};
|
|
48
|
+
WaveTearUp: {
|
|
49
|
+
shaderName: "vfx-wave-tear-up";
|
|
50
|
+
defaultIntensity: number;
|
|
51
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
52
|
+
};
|
|
53
|
+
WaveTearAcross: {
|
|
54
|
+
shaderName: "vfx-wave-tear-across";
|
|
55
|
+
defaultIntensity: number;
|
|
56
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
57
|
+
};
|
|
58
|
+
WaveBrush: {
|
|
59
|
+
shaderName: string;
|
|
60
|
+
defaultIntensity: number;
|
|
61
|
+
create: (intensity?: number | undefined) => AnimatedVfxFilter;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type AnimatedVfxEffectName = keyof typeof animatedVfxRegistry;
|
|
65
|
+
export declare const isAnimatedVfxEffectName: (effect: string) => effect is AnimatedVfxEffectName;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const WAVE_TEAR_VARIANTS: {
|
|
2
|
+
readonly WaveTearDown: {
|
|
3
|
+
readonly shaderName: "vfx-wave-tear-down";
|
|
4
|
+
readonly direction: Float32Array<ArrayBuffer>;
|
|
5
|
+
};
|
|
6
|
+
readonly WaveTearUp: {
|
|
7
|
+
readonly shaderName: "vfx-wave-tear-up";
|
|
8
|
+
readonly direction: Float32Array<ArrayBuffer>;
|
|
9
|
+
};
|
|
10
|
+
readonly WaveTearAcross: {
|
|
11
|
+
readonly shaderName: "vfx-wave-tear-across";
|
|
12
|
+
readonly direction: Float32Array<ArrayBuffer>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toStrength: (intensity: number, max?: number) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnimatedVfxFilter } from './AnimatedVfxFilter';
|
|
2
|
+
export type AnimatedVfxUniformValue = number | Float32Array;
|
|
3
|
+
export interface AnimatedVfxUniformDefinition {
|
|
4
|
+
value: AnimatedVfxUniformValue;
|
|
5
|
+
type: string;
|
|
6
|
+
}
|
|
7
|
+
export type AnimatedVfxUniformDefinitions = Record<string, AnimatedVfxUniformDefinition>;
|
|
8
|
+
export interface CreateAnimatedVfxFilterOptions {
|
|
9
|
+
name: string;
|
|
10
|
+
fragment: string;
|
|
11
|
+
intensity: number;
|
|
12
|
+
uniforms?: AnimatedVfxUniformDefinitions;
|
|
13
|
+
}
|
|
14
|
+
export interface AnimatedVfxDefinition {
|
|
15
|
+
shaderName: string;
|
|
16
|
+
defaultIntensity: number;
|
|
17
|
+
create: (intensity?: number) => AnimatedVfxFilter;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './animated-vfx';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Filter } from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a PIXI Filter that composites its input using the given blend mode,
|
|
4
|
+
* meant to be appended as the LAST entry of an element's own `filters` array
|
|
5
|
+
* — NOT applied via `Container.blendMode`.
|
|
6
|
+
*
|
|
7
|
+
* WHY: in PIXI v8, once an object has its own `filters` array, the object's
|
|
8
|
+
* effective blend mode against its backdrop is decided entirely by the LAST
|
|
9
|
+
* filter's own `Filter.blendMode` / shader (each filter carries its own
|
|
10
|
+
* compositing state). A `blendMode` set on the object or an ancestor
|
|
11
|
+
* Container is silently ignored the moment that object also has `filters` —
|
|
12
|
+
* PixiJS's BlendModePipe pushes the blend as a nested filter *inside* the
|
|
13
|
+
* object's own filter push, so its backdrop capture reads the object's own
|
|
14
|
+
* (still-empty) offscreen filter texture instead of the real scene, and the
|
|
15
|
+
* blend collapses to "just show the foreground normally".
|
|
16
|
+
*
|
|
17
|
+
* Appending the correct blend filter as the last item of the SAME `filters`
|
|
18
|
+
* array avoids this: the whole chain is one filter push, so the backdrop is
|
|
19
|
+
* captured once, correctly, and this filter's blend state is what finally
|
|
20
|
+
* composites the (fully color-adjusted) result back onto the real scene.
|
|
21
|
+
*
|
|
22
|
+
* Only call this when the element already has >0 other filters — with zero
|
|
23
|
+
* filters, `Container.blendMode` on `AbstractContainer`'s outer wrapper
|
|
24
|
+
* already works correctly (no offscreen filter pass to interfere with it).
|
|
25
|
+
*/
|
|
26
|
+
export declare const createBlendCompositeFilter: (blendModeCode: number | undefined | null) => Filter | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Filter } from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* EdgeFeatherFilter
|
|
4
|
+
*
|
|
5
|
+
* Fades an element's alpha to 0 near its own rectangular edges so that blend
|
|
6
|
+
* modes / composites melt smoothly into whatever is behind them, instead of
|
|
7
|
+
* showing the element's hard rectangle cutoff.
|
|
8
|
+
*
|
|
9
|
+
* `featherAmount` is 0 (no feather, sharp edge) to 1 (fully faded from the
|
|
10
|
+
* element's center outward — feather radius equals half of its shorter
|
|
11
|
+
* dimension).
|
|
12
|
+
*/
|
|
13
|
+
export declare class EdgeFeatherFilter extends Filter {
|
|
14
|
+
private edge;
|
|
15
|
+
constructor(featherAmount: number);
|
|
16
|
+
apply(filterManager: any, input: any, output: any, clearMode: any): void;
|
|
17
|
+
get featherAmount(): number;
|
|
18
|
+
set featherAmount(value: number);
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Filter } from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* PlateKeyFilter
|
|
4
|
+
*
|
|
5
|
+
* Knocks a flat background plate out of a logo/wordmark image at draw time.
|
|
6
|
+
*
|
|
7
|
+
* Why this exists: uploaded brand assets frequently carry a baked-in solid
|
|
8
|
+
* background. The CoffeeCo brand-kit logo is a 512x512 RGBA PNG that is 100%
|
|
9
|
+
* opaque, with every corner at rgb(236,234,218) — so the end card composited it
|
|
10
|
+
* as a hard cream rectangle floating over the plate. Measured on that asset,
|
|
11
|
+
* the border ring has a standard deviation of 3.2, i.e. it is genuinely flat and
|
|
12
|
+
* safe to key; a tolerance of ~0.16 (40/255) lifts it cleanly while leaving the
|
|
13
|
+
* dark brown lettering and the fine gold filigree untouched.
|
|
14
|
+
*
|
|
15
|
+
* This is a render-time repair, not a replacement for storing a transparent
|
|
16
|
+
* asset. It exists because the assets already sitting in customer workspaces
|
|
17
|
+
* cannot be re-uploaded retroactively.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PlateKeyFilter extends Filter {
|
|
20
|
+
private plate;
|
|
21
|
+
constructor(keyColor: [number, number, number], tolerance?: number, softness?: number);
|
|
22
|
+
get tolerance(): number;
|
|
23
|
+
set tolerance(value: number);
|
|
24
|
+
set keyColor(rgb: [number, number, number]);
|
|
25
|
+
}
|
|
26
|
+
/** Parse `#RRGGBB` / `0xRRGGBB` / `rgb(r,g,b)` into normalised 0..1 RGB. */
|
|
27
|
+
export declare function parsePlateKeyColor(input: string | number | null | undefined): [number, number, number] | null;
|
|
28
|
+
/** The cream/near-white plate that uploaded logos ship with most often. */
|
|
29
|
+
export declare const DEFAULT_PLATE_KEY_COLOR: [number, number, number];
|
|
@@ -2,6 +2,11 @@ import { PixiBaseSpriteProps, ForwardedRefResponse, containerScale } from '../ty
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as PIXI from "pixi.js";
|
|
4
4
|
interface AbstractContainerProps extends PixiBaseSpriteProps {
|
|
5
|
+
/** Container label/id override. Defaults to `getElementName(uniqueId)`. */
|
|
6
|
+
id?: string;
|
|
7
|
+
sortableChildren?: boolean;
|
|
8
|
+
/** Text handed to text-unit / typewriter effects (see usePixiAnimation). */
|
|
9
|
+
animationText?: string;
|
|
5
10
|
ignoreTlForVideo?: boolean;
|
|
6
11
|
isText?: boolean;
|
|
7
12
|
isDragging?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Container } from 'pixi.js';
|
|
2
|
-
import {
|
|
2
|
+
import { CropRect } from '../types/CropTypes';
|
|
3
|
+
import { MaskShapeInput } from './drawMaskShape';
|
|
3
4
|
import * as React from "react";
|
|
4
5
|
export interface BorderConfig {
|
|
5
6
|
width: number;
|
|
@@ -11,18 +12,32 @@ export interface BorderMaskContainerProps {
|
|
|
11
12
|
width?: number;
|
|
12
13
|
height?: number;
|
|
13
14
|
border?: BorderConfig;
|
|
15
|
+
/** `true` = radius 10% of the shorter side; a number = radius in px. */
|
|
14
16
|
roundedCorners?: boolean | number;
|
|
15
|
-
maskShape?:
|
|
17
|
+
maskShape?: MaskShapeInput;
|
|
18
|
+
/**
|
|
19
|
+
* Sprite-local crop rect (top-left origin). The mask, border and named shape
|
|
20
|
+
* are all drawn inside this sub-rect.
|
|
21
|
+
*/
|
|
22
|
+
crop?: CropRect;
|
|
16
23
|
spriteRef?: React.RefObject<Container | null>;
|
|
17
|
-
children
|
|
24
|
+
children?: React.ReactNode;
|
|
18
25
|
}
|
|
19
26
|
/**
|
|
20
|
-
* BorderMaskContainer — wraps a sprite child with an optional stroke
|
|
21
|
-
*
|
|
27
|
+
* BorderMaskContainer — wraps a sprite child with an optional stroke border
|
|
28
|
+
* and/or a Graphics mask (rounded rect, named shape, or crop rect).
|
|
22
29
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
30
|
+
* Ported from the Clippy editor:
|
|
31
|
+
* - declarative `draw` callbacks (redraw when their deps change)
|
|
32
|
+
* - `useLayoutEffect` attaches the mask before paint (no unmasked flash)
|
|
33
|
+
* - the wrapper container is ALWAYS rendered, so toggling a border/mask never
|
|
34
|
+
* changes the tree shape and remounts the sprite child (texture/ref reset)
|
|
35
|
+
* - mask/border Graphics mount only when needed: an empty Graphics still adds
|
|
36
|
+
* its (0,0) origin to the parent's getBounds() and inflates transformer boxes
|
|
25
37
|
*/
|
|
26
|
-
declare const BorderMaskContainer:
|
|
38
|
+
declare const BorderMaskContainer: {
|
|
39
|
+
({ x, y, width, height, border, roundedCorners, maskShape, crop, spriteRef, children, }: BorderMaskContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
27
42
|
export default BorderMaskContainer;
|
|
28
43
|
export { BorderMaskContainer };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { Graphics } from 'pixi.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { MaskTypes } from '../types/MaskTypes';
|
|
3
|
+
import { CropRect } from '../types/CropTypes';
|
|
4
|
+
/** Accepts the enum or its plain string value (e.g. 'circle' from JSON). */
|
|
5
|
+
export type MaskShapeInput = MaskTypes | `${MaskTypes}`;
|
|
6
|
+
export declare function drawMaskShape(g: Graphics, shape: MaskShapeInput, cx: number, cy: number, w: number, h: number, crop?: CropRect): void;
|
|
7
|
+
export declare function applyMaskClipPath(ctx: CanvasRenderingContext2D, shape: MaskShapeInput, w: number, h: number, crop?: CropRect): void;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export * from './useGsapEffect';
|
|
2
2
|
export * from './useSpriteFilters';
|
|
3
3
|
export * from './aep';
|
|
4
|
+
export { default as usePixiAnimation } from './usePixiAnimation';
|
|
5
|
+
export { useVideoTexture } from './video/useVideoTexture';
|
|
6
|
+
export { useVideoLifecycle } from './video/useVideoLifecycle';
|
|
7
|
+
export { useVideoTimelineSync } from './video/useVideoTimelineSync';
|
|
8
|
+
export { withFiltersHook } from './withFiltersHook';
|
|
9
|
+
export { withEffectsHook, useEffects, getEffectFilter } from './withEffectsHook';
|
|
10
|
+
export { fromMultiplierColorCorrection, type SpriteColorCorrection, type SpriteEffectsInput } from './useSpriteFilters';
|
|
11
|
+
export { useSvgTexture, type UseSvgTextureOptions } from './useSvgTexture';
|
|
12
|
+
export { useDebouncedValue } from './useDebouncedValue';
|
|
13
|
+
export { useFontEpoch } from './useFontEpoch';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PixiBlendModeString } from '../utils/blendMode';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the editor's numeric blend-mode code (from `transformation.blendMode`)
|
|
4
|
+
* to the PIXI v8 string value expected by `Container.blendMode` / `Sprite.blendMode`.
|
|
5
|
+
*
|
|
6
|
+
* PIXI v8 replaced the old numeric `BLEND_MODES` enum with a string union
|
|
7
|
+
* ('normal' | 'multiply' | 'darken' | ...). Photoshop-style modes (Overlay,
|
|
8
|
+
* Darken, Lighten, Color Dodge/Burn, Hard/Soft Light) additionally require the
|
|
9
|
+
* `pixi.js/advanced-blend-modes` side-effect module to be imported once at app
|
|
10
|
+
* bootstrap (see src/index.tsx) — without it those string values are inert and
|
|
11
|
+
* the renderer silently falls back to 'normal'.
|
|
12
|
+
*
|
|
13
|
+
* Callers set the returned string directly on a Container/Sprite's `blendMode`
|
|
14
|
+
* prop — no filter needed for this to take effect.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useBlendFilter: (blendMode?: number) => PixiBlendModeString;
|
|
17
|
+
export default useBlendFilter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `value`, but only after it has stopped changing for `delayMs`.
|
|
3
|
+
*
|
|
4
|
+
* A single timer is restarted on every change and cleared on cleanup, so only the FINAL value
|
|
5
|
+
* of a burst is ever published, never an intermediate one. (`delayMs <= 0` publishes on the
|
|
6
|
+
* next effect tick.) The first value is returned immediately.
|
|
7
|
+
*
|
|
8
|
+
* Used by `useSvgTexture` / `PixiSvgRawSprite` so dragging a resize handle re-rasterises once.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useDebouncedValue<T>(value: T, delayMs: number): T;
|
|
11
|
+
export default useDebouncedValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A counter that increments every time fonts finish loading (`Events.FONTS_LOADED`).
|
|
3
|
+
*
|
|
4
|
+
* Put it in any memo/effect dependency list that builds a `TextStyle` or a text layout, so it
|
|
5
|
+
* re-runs against the real font instead of the fallback it measured with before the load.
|
|
6
|
+
* On each event it also flushes both measurement caches:
|
|
7
|
+
* - Pixi's `CanvasTextMetrics` (keyed by font string)
|
|
8
|
+
* - this engine's default layout metrics provider
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFontEpoch(): number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* usePixiAnimation
|
|
3
|
+
*
|
|
4
|
+
* Drives entrance/exit animations by creating a child timeline and adding it
|
|
5
|
+
* to the parent GSAP timeline. Follows the same pattern as PixiSequence for
|
|
6
|
+
* consistent timeline nesting behavior.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} config - Animation configuration
|
|
9
|
+
* @param {React.RefObject} config.targetRef - Reference to the PIXI container
|
|
10
|
+
* @param {Object} config.transformation - Transformation properties
|
|
11
|
+
* @param {number} config.start - Element start time in seconds
|
|
12
|
+
* @param {number} config.end - Element end time in seconds
|
|
13
|
+
* @param {Object} [config.effectOptions] - Additional options for GSAP effects
|
|
14
|
+
*/
|
|
15
|
+
declare const usePixiAnimation: ({ targetRef, transformation, start, end, effectOptions }: {
|
|
16
|
+
targetRef: any;
|
|
17
|
+
transformation: any;
|
|
18
|
+
start: any;
|
|
19
|
+
end: any;
|
|
20
|
+
effectOptions?: {} | undefined;
|
|
21
|
+
}) => {
|
|
22
|
+
childTimelineRef: import('react').RefObject<null>;
|
|
23
|
+
};
|
|
24
|
+
export default usePixiAnimation;
|
|
@@ -1,39 +1,81 @@
|
|
|
1
1
|
import { Effects } from '../types/Effects';
|
|
2
|
-
import * as PIXI from "pixi.js";
|
|
2
|
+
import type * as PIXI from "pixi.js";
|
|
3
|
+
/**
|
|
4
|
+
* Colour correction in SLIDER units (ported from the Clippy editor).
|
|
5
|
+
*
|
|
6
|
+
* brightness, contrast, saturation, red, green, blue,
|
|
7
|
+
* temperature, tint, highlights, shadows, exposure, vibrance : -100..100, 0 = no change
|
|
8
|
+
* hue : -180..180 degrees
|
|
9
|
+
* sharpness, blurRadius, vignette, noise, edgeFeather : 0..100
|
|
10
|
+
* gamma, alpha : 1 = no change
|
|
11
|
+
*
|
|
12
|
+
* This replaces the earlier multiplier convention (neutral = 1). To convert old
|
|
13
|
+
* values use `fromMultiplierColorCorrection`.
|
|
14
|
+
*/
|
|
3
15
|
export interface SpriteColorCorrection {
|
|
4
16
|
enabled?: boolean;
|
|
17
|
+
brightness?: number;
|
|
5
18
|
contrast?: number;
|
|
6
19
|
saturation?: number;
|
|
7
|
-
brightness?: number;
|
|
8
|
-
alpha?: number;
|
|
9
20
|
red?: number;
|
|
10
21
|
green?: number;
|
|
11
22
|
blue?: number;
|
|
12
23
|
gamma?: number;
|
|
13
|
-
|
|
24
|
+
alpha?: number;
|
|
14
25
|
temperature?: number;
|
|
26
|
+
tint?: number;
|
|
15
27
|
hue?: number;
|
|
28
|
+
highlights?: number;
|
|
29
|
+
shadows?: number;
|
|
30
|
+
exposure?: number;
|
|
31
|
+
vibrance?: number;
|
|
16
32
|
sharpness?: number;
|
|
33
|
+
blurRadius?: number;
|
|
17
34
|
vignette?: number;
|
|
18
35
|
noise?: number;
|
|
36
|
+
edgeFeather?: number;
|
|
19
37
|
}
|
|
20
38
|
export interface SpriteEffectsInput {
|
|
21
39
|
name?: Effects | string;
|
|
40
|
+
/** 0..100. Defaults to 100 for any real effect, 0 for "None". */
|
|
22
41
|
intensity?: number;
|
|
23
42
|
params?: Record<string, unknown>;
|
|
24
43
|
}
|
|
44
|
+
export type PlateKeyInput = boolean | string | {
|
|
45
|
+
color?: string;
|
|
46
|
+
tolerance?: number;
|
|
47
|
+
} | null;
|
|
25
48
|
export interface UseSpriteFiltersProps {
|
|
26
49
|
colorCorrection?: SpriteColorCorrection;
|
|
27
50
|
effects?: SpriteEffectsInput;
|
|
51
|
+
neonColor?: number | string | null;
|
|
52
|
+
/** `transformation.blendMode` (numeric code). Appended as the LAST filter when others exist. */
|
|
53
|
+
blendMode?: number;
|
|
54
|
+
/** Key a flat background plate out of the image. `true` = default cream plate. */
|
|
55
|
+
plateKey?: PlateKeyInput;
|
|
28
56
|
}
|
|
29
57
|
/**
|
|
30
|
-
*
|
|
31
|
-
* `
|
|
32
|
-
*
|
|
58
|
+
* Convert the old multiplier-style correction (neutral = 1: `contrast: 2`) to the
|
|
59
|
+
* slider scale (neutral = 0: `contrast: 100`). Fields that were not multipliers
|
|
60
|
+
* (hue, temperature, sharpness, blurRadius, vignette, noise, gamma, alpha) pass
|
|
61
|
+
* through unchanged. Only the six multiplier fields are rescaled.
|
|
62
|
+
*/
|
|
63
|
+
export declare const fromMultiplierColorCorrection: (old: Record<string, number | undefined> | null | undefined) => SpriteColorCorrection;
|
|
64
|
+
/**
|
|
65
|
+
* One ordered filter array for a sprite: plate-key -> colour correction ->
|
|
66
|
+
* effect preset(s) -> blur/vignette/noise -> blend composite (last).
|
|
67
|
+
*
|
|
68
|
+
* Ported from the Clippy editor, with two deliberate differences:
|
|
69
|
+
* - colour-correction fields are read individually so the memo only re-runs when a
|
|
70
|
+
* value changes, not whenever the caller passes a fresh `{}`
|
|
71
|
+
* - the filters this hook created are destroyed when they are replaced or on
|
|
72
|
+
* unmount (Clippy leaks them)
|
|
73
|
+
*
|
|
74
|
+
* Time-varying effects (VHS, glitch, godray...) are driven from the master GSAP
|
|
75
|
+
* timeline via `registerTimeUpdateListener`, so they follow the playhead: animate
|
|
76
|
+
* while playing, jump on seek, freeze when paused. Deterministic for export.
|
|
33
77
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* `filters: []` allocating a render target on the sprite).
|
|
78
|
+
* Returns `[]` (never null) when no filter applies, so it is safe to pass straight
|
|
79
|
+
* to `<pixiSprite filters={...}>`.
|
|
37
80
|
*/
|
|
38
|
-
export declare const useSpriteFilters: ({ colorCorrection, effects, }: UseSpriteFiltersProps) => PIXI.Filter[];
|
|
39
|
-
export default useSpriteFilters;
|
|
81
|
+
export declare const useSpriteFilters: ({ colorCorrection, effects, neonColor, blendMode, plateKey, }: UseSpriteFiltersProps) => PIXI.Filter[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as PIXI from "pixi.js";
|
|
2
|
+
export interface UseSvgTextureOptions {
|
|
3
|
+
src?: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
/** Render multiplier. 2 gives crisp results without devicePixelRatio jitter. */
|
|
9
|
+
resolution?: number;
|
|
10
|
+
/** ms to wait after the LAST width/height change before re-rasterising. Default 120. */
|
|
11
|
+
resizeDebounceMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface UseSvgTextureResult {
|
|
14
|
+
texture: PIXI.Texture | null;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Rasterise an SVG (with optional stroke override) to a PIXI.Texture at
|
|
19
|
+
* `width x height x resolution`. Non-SVG sources fall back to the regular texture loader.
|
|
20
|
+
* Ported from the Clippy editor's `useSvgTexture`, with these fixes:
|
|
21
|
+
*
|
|
22
|
+
* - The previous texture (and its canvas) is DESTROYED when a new one replaces it and on
|
|
23
|
+
* unmount. Clippy leaked one CanvasSource per re-raster.
|
|
24
|
+
* - width/height changes are debounced, so dragging a resize handle re-rasterises once
|
|
25
|
+
* after the drag settles instead of on every pointer move.
|
|
26
|
+
* - Inline `data:image/svg+xml` sources are rasterised too (Clippy only matched `.svg` URLs).
|
|
27
|
+
* - A failed fetch (HTTP error) yields `null` instead of rasterising an error page.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useSvgTexture({ src, width, height, stroke, strokeWidth, resolution, resizeDebounceMs, }: UseSvgTextureOptions): UseSvgTextureResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface VideoLifecycleState {
|
|
2
|
+
isPlaying: boolean;
|
|
3
|
+
progress: number;
|
|
4
|
+
isMuted: boolean;
|
|
5
|
+
isWaiting: boolean;
|
|
6
|
+
isStalled: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* useVideoLifecycle
|
|
10
|
+
*
|
|
11
|
+
* Attaches DOM event listeners to track waiting / stalled / loaded state
|
|
12
|
+
* on the underlying HTMLVideoElement. Returns a mutable state ref the caller
|
|
13
|
+
* can read inside GSAP callbacks (without triggering React re-renders).
|
|
14
|
+
*
|
|
15
|
+
* Also keeps `muted` and `playbackRate` in sync with props via dedicated
|
|
16
|
+
* effects — each prop change touches only the relevant attribute.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useVideoLifecycle({ getVideo, ready, muted, playbackRate, }: {
|
|
19
|
+
getVideo: () => HTMLVideoElement | null | undefined;
|
|
20
|
+
ready: boolean;
|
|
21
|
+
muted: boolean;
|
|
22
|
+
playbackRate: number;
|
|
23
|
+
}): React.MutableRefObject<VideoLifecycleState>;
|