@twick/core 0.15.20 → 0.15.22
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/dist/index.cjs +115 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +117 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -2840,6 +2840,29 @@ declare class WasmExporter implements Exporter {
|
|
|
2840
2840
|
downloadVideos(assets: AssetInfo[][]): Promise<void>;
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
+
/**
|
|
2844
|
+
* WASM exporter that applies GL effects from variables.input.tracks before encoding.
|
|
2845
|
+
* Use exporter name '@twick/core/wasm-effects' when rendering with effect tracks.
|
|
2846
|
+
*/
|
|
2847
|
+
declare class WasmEffectsExporter implements Exporter {
|
|
2848
|
+
private readonly project;
|
|
2849
|
+
private readonly settings;
|
|
2850
|
+
private readonly inner;
|
|
2851
|
+
static readonly id = "@twick/core/wasm-effects";
|
|
2852
|
+
static readonly displayName = "Video (Wasm + Effects)";
|
|
2853
|
+
static create(project: Project, settings: RendererSettings): Promise<WasmEffectsExporter>;
|
|
2854
|
+
private effectGlCanvas;
|
|
2855
|
+
private effectContext;
|
|
2856
|
+
private effectReadbackFbo;
|
|
2857
|
+
constructor(project: Project, settings: RendererSettings, inner: WasmExporter);
|
|
2858
|
+
start(): Promise<void>;
|
|
2859
|
+
handleFrame(canvas: HTMLCanvasElement, frame: number, sceneFrame: number, sceneName: string, signal: AbortSignal): Promise<void>;
|
|
2860
|
+
stop(result?: unknown): Promise<void>;
|
|
2861
|
+
generateAudio(assets: AssetInfo[][], startFrame: number, endFrame: number): Promise<void>;
|
|
2862
|
+
mergeMedia(): Promise<void>;
|
|
2863
|
+
downloadVideos(assets: AssetInfo[][]): Promise<void>;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2843
2866
|
interface Versions {
|
|
2844
2867
|
core: string;
|
|
2845
2868
|
two: string | null;
|
|
@@ -2860,6 +2883,8 @@ type ExporterSettings = {
|
|
|
2860
2883
|
options: FfmpegExporterOptions;
|
|
2861
2884
|
} | {
|
|
2862
2885
|
name: '@twick/core/wasm';
|
|
2886
|
+
} | {
|
|
2887
|
+
name: '@twick/core/wasm-effects';
|
|
2863
2888
|
};
|
|
2864
2889
|
interface ProjectSettings {
|
|
2865
2890
|
shared: {
|
|
@@ -2978,6 +3003,16 @@ interface Project extends Omit<UserProject, 'settings'> {
|
|
|
2978
3003
|
* package.json files of the packages.
|
|
2979
3004
|
*/
|
|
2980
3005
|
versions: Versions;
|
|
3006
|
+
/**
|
|
3007
|
+
* Optional resolver for active GL effects per frame. Provided by the host (e.g. twick)
|
|
3008
|
+
* so effect logic (catalog, custom fragments) lives outside twick-base.
|
|
3009
|
+
* When set, WasmEffectsExporter uses this instead of built-in resolution.
|
|
3010
|
+
*/
|
|
3011
|
+
getActiveEffectsForFrame?: (variables: Record<string, unknown>, frame: number, fps: number) => Array<{
|
|
3012
|
+
fragment: string;
|
|
3013
|
+
progress: number;
|
|
3014
|
+
intensity: number;
|
|
3015
|
+
}>;
|
|
2981
3016
|
}
|
|
2982
3017
|
|
|
2983
3018
|
declare const defaultUserProjectSettings: UserProjectSettings;
|
|
@@ -2988,6 +3023,11 @@ declare function addEditorToProject(project: Project): Promise<{
|
|
|
2988
3023
|
settings: ProjectSettings;
|
|
2989
3024
|
logger: Logger;
|
|
2990
3025
|
versions: Versions;
|
|
3026
|
+
getActiveEffectsForFrame?: (variables: Record<string, unknown>, frame: number, fps: number) => Array<{
|
|
3027
|
+
fragment: string;
|
|
3028
|
+
progress: number;
|
|
3029
|
+
intensity: number;
|
|
3030
|
+
}>;
|
|
2991
3031
|
scenes: SceneDescription<any>[];
|
|
2992
3032
|
variables?: Record<string, unknown> | undefined;
|
|
2993
3033
|
experimentalFeatures?: boolean | undefined;
|
|
@@ -3916,4 +3956,4 @@ declare function endThread(thread: Thread): void;
|
|
|
3916
3956
|
*/
|
|
3917
3957
|
declare function useTime(): number;
|
|
3918
3958
|
|
|
3919
|
-
export { type AssetInfo, AsyncEventDispatcher, type AsyncEventHandler, BBox, BeatSpring, BounceSpring, type CachedSceneData, type CanvasColorSpace, type CanvasOutputMimeType, Center, Color, type ColorObject, type ColorSignal, type CompoundSignal, CompoundSignalContext, type Computed, ComputedContext, DEFAULT, DEG2RAD, _default as DefaultPlugin, DependencyContext, type DescriptionOf, DetailedError, Direction, EPSILON, EventDispatcher, EventDispatcherBase, type EventHandler, type EveryCallback, type EveryTimer, ExperimentalError, type Exporter, type ExporterClass, type ExporterSettings, FFmpegExporterClient, type FfmpegExporterOptions, FlagDispatcher, type FullSceneDescription, GeneratorScene, type ImageDataSource, ImageExporter, type ImageExporterOptions, type Inspectable, type InspectedAttributes, type InspectedElement, type InterpolationFunction, JumpSpring, LifecycleEvents, LogLevel, type LogPayload, Logger, type LoopCallback, Matrix2D, Origin, type PartialUserProjectSettings, PlaybackManager, PlaybackState, PlaybackStatus, Player, type PlayerSettings, type PlayerState, PlopSpring, type Plugin, type PossibleBBox, type PossibleColor, type PossibleMatrix2D, type PossibleSpacing, type PossibleVector2, type Project, type ProjectSettings, type Promisable, type PromiseHandle, RAD2DEG, Random, type RectSignal, type Reference, type ReferenceArray, type ReferenceMap, type ReferenceReceiver, type RefsProperty, type RenderVideoUserProjectSettings, Renderer, RendererResult, type RendererSettings, RendererState, type Scene, type SceneConstructor, type SceneDescription, type SceneDescriptionReload, SceneRenderEvent, SceneState, Semaphore, type SerializedBBox, type SerializedColor, type SerializedSpacing, type SerializedVector2, Shaders, SharedWebGLContext, type Signal, SignalContext, type SignalExtensions, type SignalGenerator, type SignalGetter, type SignalSetter, type SignalTween, type SignalValue, type SimpleSignal, type SimpleVector2Signal, type Slide, Slides, SmoothSpring, Spacing, type SpacingSignal, type Spring, Stage, type StageSettings, StrikeSpring, Subscribable, type SubscribableAsyncEvent, type SubscribableEvent, type SubscribableFlagEvent, SubscribableValueEvent, SwingSpring, Thread, type ThreadGenerator, type ThreadGeneratorFactory, type Threadable, type ThreadsCallback, type ThreadsFactory, type TimingFunction, type Type, UNIFORM_DELTA_TIME, UNIFORM_DESTINATION_MATRIX, UNIFORM_DESTINATION_TEXTURE, UNIFORM_FRAME, UNIFORM_FRAMERATE, UNIFORM_RESOLUTION, UNIFORM_SOURCE_MATRIX, UNIFORM_SOURCE_TEXTURE, UNIFORM_TIME, type UserProject, type UserProjectSettings, ValueDispatcher, Variables, Vector2, type Vector2Signal, type Versions, WasmExporter, type WebGLContextOwner, type WebGLConvertible, addEditorToProject, all, any, arcLerp, beginSlide, boolLerp, cancel, capitalize, chain, clamp, clampRemap, cos, createComputed, createComputedAsync, createEaseInBack, createEaseInBounce, createEaseInElastic, createEaseInOutBack, createEaseInOutBounce, createEaseInOutElastic, createEaseOutBack, createEaseOutBounce, createEaseOutElastic, createRef, createRefArray, createRefMap, createSignal, createVersionObject, debug, decorate, deepLerp, defaultUserProjectSettings, delay, deprecate, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, endPlayback, endScene, endThread, errorToLog, every, experimentalFeatures, experimentalLog, fadeTransition, finishScene, flipOrigin, getContext, getFullPreviewSettings, getFullRenderingSettings, getImageData, getTaskName, isInspectable, isPromisable, isPromise, isReactive, isThreadGenerator, isThreadable, isType, join, lazy, linear, loadAnimation, loadImage, loop, loopFor, makePlugin, makeProject, makeRef, makeRefs, makeSpring, map, modify, noop, originToOffset, range, remap, rotateVector, run, sequence, setTaskName, sin, slideTransition, spawn, spring, startPlayback, startScene, startThread, textLerp, threadable, threads, transformAngle, transformScalar, transformVector, transformVectorAsPoint, tween, unwrap, useContext, useContextAfter, useLogger, usePlayback, useScene, useThread, useTime, useTransition, waitFor, zoomInTransition, zoomOutTransition };
|
|
3959
|
+
export { type AssetInfo, AsyncEventDispatcher, type AsyncEventHandler, BBox, BeatSpring, BounceSpring, type CachedSceneData, type CanvasColorSpace, type CanvasOutputMimeType, Center, Color, type ColorObject, type ColorSignal, type CompoundSignal, CompoundSignalContext, type Computed, ComputedContext, DEFAULT, DEG2RAD, _default as DefaultPlugin, DependencyContext, type DescriptionOf, DetailedError, Direction, EPSILON, EventDispatcher, EventDispatcherBase, type EventHandler, type EveryCallback, type EveryTimer, ExperimentalError, type Exporter, type ExporterClass, type ExporterSettings, FFmpegExporterClient, type FfmpegExporterOptions, FlagDispatcher, type FullSceneDescription, GeneratorScene, type ImageDataSource, ImageExporter, type ImageExporterOptions, type Inspectable, type InspectedAttributes, type InspectedElement, type InterpolationFunction, JumpSpring, LifecycleEvents, LogLevel, type LogPayload, Logger, type LoopCallback, Matrix2D, Origin, type PartialUserProjectSettings, PlaybackManager, PlaybackState, PlaybackStatus, Player, type PlayerSettings, type PlayerState, PlopSpring, type Plugin, type PossibleBBox, type PossibleColor, type PossibleMatrix2D, type PossibleSpacing, type PossibleVector2, type Project, type ProjectSettings, type Promisable, type PromiseHandle, RAD2DEG, Random, type RectSignal, type Reference, type ReferenceArray, type ReferenceMap, type ReferenceReceiver, type RefsProperty, type RenderVideoUserProjectSettings, Renderer, RendererResult, type RendererSettings, RendererState, type Scene, type SceneConstructor, type SceneDescription, type SceneDescriptionReload, SceneRenderEvent, SceneState, Semaphore, type SerializedBBox, type SerializedColor, type SerializedSpacing, type SerializedVector2, Shaders, SharedWebGLContext, type Signal, SignalContext, type SignalExtensions, type SignalGenerator, type SignalGetter, type SignalSetter, type SignalTween, type SignalValue, type SimpleSignal, type SimpleVector2Signal, type Slide, Slides, SmoothSpring, Spacing, type SpacingSignal, type Spring, Stage, type StageSettings, StrikeSpring, Subscribable, type SubscribableAsyncEvent, type SubscribableEvent, type SubscribableFlagEvent, SubscribableValueEvent, SwingSpring, Thread, type ThreadGenerator, type ThreadGeneratorFactory, type Threadable, type ThreadsCallback, type ThreadsFactory, type TimingFunction, type Type, UNIFORM_DELTA_TIME, UNIFORM_DESTINATION_MATRIX, UNIFORM_DESTINATION_TEXTURE, UNIFORM_FRAME, UNIFORM_FRAMERATE, UNIFORM_RESOLUTION, UNIFORM_SOURCE_MATRIX, UNIFORM_SOURCE_TEXTURE, UNIFORM_TIME, type UserProject, type UserProjectSettings, ValueDispatcher, Variables, Vector2, type Vector2Signal, type Versions, WasmEffectsExporter, WasmExporter, type WebGLContextOwner, type WebGLConvertible, addEditorToProject, all, any, arcLerp, beginSlide, boolLerp, cancel, capitalize, chain, clamp, clampRemap, cos, createComputed, createComputedAsync, createEaseInBack, createEaseInBounce, createEaseInElastic, createEaseInOutBack, createEaseInOutBounce, createEaseInOutElastic, createEaseOutBack, createEaseOutBounce, createEaseOutElastic, createRef, createRefArray, createRefMap, createSignal, createVersionObject, debug, decorate, deepLerp, defaultUserProjectSettings, delay, deprecate, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, endPlayback, endScene, endThread, errorToLog, every, experimentalFeatures, experimentalLog, fadeTransition, finishScene, flipOrigin, getContext, getFullPreviewSettings, getFullRenderingSettings, getImageData, getTaskName, isInspectable, isPromisable, isPromise, isReactive, isThreadGenerator, isThreadable, isType, join, lazy, linear, loadAnimation, loadImage, loop, loopFor, makePlugin, makeProject, makeRef, makeRefs, makeSpring, map, modify, noop, originToOffset, range, remap, rotateVector, run, sequence, setTaskName, sin, slideTransition, spawn, spring, startPlayback, startScene, startThread, textLerp, threadable, threads, transformAngle, transformScalar, transformVector, transformVectorAsPoint, tween, unwrap, useContext, useContextAfter, useLogger, usePlayback, useScene, useThread, useTime, useTransition, waitFor, zoomInTransition, zoomOutTransition };
|
package/dist/index.d.ts
CHANGED
|
@@ -2840,6 +2840,29 @@ declare class WasmExporter implements Exporter {
|
|
|
2840
2840
|
downloadVideos(assets: AssetInfo[][]): Promise<void>;
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
+
/**
|
|
2844
|
+
* WASM exporter that applies GL effects from variables.input.tracks before encoding.
|
|
2845
|
+
* Use exporter name '@twick/core/wasm-effects' when rendering with effect tracks.
|
|
2846
|
+
*/
|
|
2847
|
+
declare class WasmEffectsExporter implements Exporter {
|
|
2848
|
+
private readonly project;
|
|
2849
|
+
private readonly settings;
|
|
2850
|
+
private readonly inner;
|
|
2851
|
+
static readonly id = "@twick/core/wasm-effects";
|
|
2852
|
+
static readonly displayName = "Video (Wasm + Effects)";
|
|
2853
|
+
static create(project: Project, settings: RendererSettings): Promise<WasmEffectsExporter>;
|
|
2854
|
+
private effectGlCanvas;
|
|
2855
|
+
private effectContext;
|
|
2856
|
+
private effectReadbackFbo;
|
|
2857
|
+
constructor(project: Project, settings: RendererSettings, inner: WasmExporter);
|
|
2858
|
+
start(): Promise<void>;
|
|
2859
|
+
handleFrame(canvas: HTMLCanvasElement, frame: number, sceneFrame: number, sceneName: string, signal: AbortSignal): Promise<void>;
|
|
2860
|
+
stop(result?: unknown): Promise<void>;
|
|
2861
|
+
generateAudio(assets: AssetInfo[][], startFrame: number, endFrame: number): Promise<void>;
|
|
2862
|
+
mergeMedia(): Promise<void>;
|
|
2863
|
+
downloadVideos(assets: AssetInfo[][]): Promise<void>;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2843
2866
|
interface Versions {
|
|
2844
2867
|
core: string;
|
|
2845
2868
|
two: string | null;
|
|
@@ -2860,6 +2883,8 @@ type ExporterSettings = {
|
|
|
2860
2883
|
options: FfmpegExporterOptions;
|
|
2861
2884
|
} | {
|
|
2862
2885
|
name: '@twick/core/wasm';
|
|
2886
|
+
} | {
|
|
2887
|
+
name: '@twick/core/wasm-effects';
|
|
2863
2888
|
};
|
|
2864
2889
|
interface ProjectSettings {
|
|
2865
2890
|
shared: {
|
|
@@ -2978,6 +3003,16 @@ interface Project extends Omit<UserProject, 'settings'> {
|
|
|
2978
3003
|
* package.json files of the packages.
|
|
2979
3004
|
*/
|
|
2980
3005
|
versions: Versions;
|
|
3006
|
+
/**
|
|
3007
|
+
* Optional resolver for active GL effects per frame. Provided by the host (e.g. twick)
|
|
3008
|
+
* so effect logic (catalog, custom fragments) lives outside twick-base.
|
|
3009
|
+
* When set, WasmEffectsExporter uses this instead of built-in resolution.
|
|
3010
|
+
*/
|
|
3011
|
+
getActiveEffectsForFrame?: (variables: Record<string, unknown>, frame: number, fps: number) => Array<{
|
|
3012
|
+
fragment: string;
|
|
3013
|
+
progress: number;
|
|
3014
|
+
intensity: number;
|
|
3015
|
+
}>;
|
|
2981
3016
|
}
|
|
2982
3017
|
|
|
2983
3018
|
declare const defaultUserProjectSettings: UserProjectSettings;
|
|
@@ -2988,6 +3023,11 @@ declare function addEditorToProject(project: Project): Promise<{
|
|
|
2988
3023
|
settings: ProjectSettings;
|
|
2989
3024
|
logger: Logger;
|
|
2990
3025
|
versions: Versions;
|
|
3026
|
+
getActiveEffectsForFrame?: (variables: Record<string, unknown>, frame: number, fps: number) => Array<{
|
|
3027
|
+
fragment: string;
|
|
3028
|
+
progress: number;
|
|
3029
|
+
intensity: number;
|
|
3030
|
+
}>;
|
|
2991
3031
|
scenes: SceneDescription<any>[];
|
|
2992
3032
|
variables?: Record<string, unknown> | undefined;
|
|
2993
3033
|
experimentalFeatures?: boolean | undefined;
|
|
@@ -3916,4 +3956,4 @@ declare function endThread(thread: Thread): void;
|
|
|
3916
3956
|
*/
|
|
3917
3957
|
declare function useTime(): number;
|
|
3918
3958
|
|
|
3919
|
-
export { type AssetInfo, AsyncEventDispatcher, type AsyncEventHandler, BBox, BeatSpring, BounceSpring, type CachedSceneData, type CanvasColorSpace, type CanvasOutputMimeType, Center, Color, type ColorObject, type ColorSignal, type CompoundSignal, CompoundSignalContext, type Computed, ComputedContext, DEFAULT, DEG2RAD, _default as DefaultPlugin, DependencyContext, type DescriptionOf, DetailedError, Direction, EPSILON, EventDispatcher, EventDispatcherBase, type EventHandler, type EveryCallback, type EveryTimer, ExperimentalError, type Exporter, type ExporterClass, type ExporterSettings, FFmpegExporterClient, type FfmpegExporterOptions, FlagDispatcher, type FullSceneDescription, GeneratorScene, type ImageDataSource, ImageExporter, type ImageExporterOptions, type Inspectable, type InspectedAttributes, type InspectedElement, type InterpolationFunction, JumpSpring, LifecycleEvents, LogLevel, type LogPayload, Logger, type LoopCallback, Matrix2D, Origin, type PartialUserProjectSettings, PlaybackManager, PlaybackState, PlaybackStatus, Player, type PlayerSettings, type PlayerState, PlopSpring, type Plugin, type PossibleBBox, type PossibleColor, type PossibleMatrix2D, type PossibleSpacing, type PossibleVector2, type Project, type ProjectSettings, type Promisable, type PromiseHandle, RAD2DEG, Random, type RectSignal, type Reference, type ReferenceArray, type ReferenceMap, type ReferenceReceiver, type RefsProperty, type RenderVideoUserProjectSettings, Renderer, RendererResult, type RendererSettings, RendererState, type Scene, type SceneConstructor, type SceneDescription, type SceneDescriptionReload, SceneRenderEvent, SceneState, Semaphore, type SerializedBBox, type SerializedColor, type SerializedSpacing, type SerializedVector2, Shaders, SharedWebGLContext, type Signal, SignalContext, type SignalExtensions, type SignalGenerator, type SignalGetter, type SignalSetter, type SignalTween, type SignalValue, type SimpleSignal, type SimpleVector2Signal, type Slide, Slides, SmoothSpring, Spacing, type SpacingSignal, type Spring, Stage, type StageSettings, StrikeSpring, Subscribable, type SubscribableAsyncEvent, type SubscribableEvent, type SubscribableFlagEvent, SubscribableValueEvent, SwingSpring, Thread, type ThreadGenerator, type ThreadGeneratorFactory, type Threadable, type ThreadsCallback, type ThreadsFactory, type TimingFunction, type Type, UNIFORM_DELTA_TIME, UNIFORM_DESTINATION_MATRIX, UNIFORM_DESTINATION_TEXTURE, UNIFORM_FRAME, UNIFORM_FRAMERATE, UNIFORM_RESOLUTION, UNIFORM_SOURCE_MATRIX, UNIFORM_SOURCE_TEXTURE, UNIFORM_TIME, type UserProject, type UserProjectSettings, ValueDispatcher, Variables, Vector2, type Vector2Signal, type Versions, WasmExporter, type WebGLContextOwner, type WebGLConvertible, addEditorToProject, all, any, arcLerp, beginSlide, boolLerp, cancel, capitalize, chain, clamp, clampRemap, cos, createComputed, createComputedAsync, createEaseInBack, createEaseInBounce, createEaseInElastic, createEaseInOutBack, createEaseInOutBounce, createEaseInOutElastic, createEaseOutBack, createEaseOutBounce, createEaseOutElastic, createRef, createRefArray, createRefMap, createSignal, createVersionObject, debug, decorate, deepLerp, defaultUserProjectSettings, delay, deprecate, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, endPlayback, endScene, endThread, errorToLog, every, experimentalFeatures, experimentalLog, fadeTransition, finishScene, flipOrigin, getContext, getFullPreviewSettings, getFullRenderingSettings, getImageData, getTaskName, isInspectable, isPromisable, isPromise, isReactive, isThreadGenerator, isThreadable, isType, join, lazy, linear, loadAnimation, loadImage, loop, loopFor, makePlugin, makeProject, makeRef, makeRefs, makeSpring, map, modify, noop, originToOffset, range, remap, rotateVector, run, sequence, setTaskName, sin, slideTransition, spawn, spring, startPlayback, startScene, startThread, textLerp, threadable, threads, transformAngle, transformScalar, transformVector, transformVectorAsPoint, tween, unwrap, useContext, useContextAfter, useLogger, usePlayback, useScene, useThread, useTime, useTransition, waitFor, zoomInTransition, zoomOutTransition };
|
|
3959
|
+
export { type AssetInfo, AsyncEventDispatcher, type AsyncEventHandler, BBox, BeatSpring, BounceSpring, type CachedSceneData, type CanvasColorSpace, type CanvasOutputMimeType, Center, Color, type ColorObject, type ColorSignal, type CompoundSignal, CompoundSignalContext, type Computed, ComputedContext, DEFAULT, DEG2RAD, _default as DefaultPlugin, DependencyContext, type DescriptionOf, DetailedError, Direction, EPSILON, EventDispatcher, EventDispatcherBase, type EventHandler, type EveryCallback, type EveryTimer, ExperimentalError, type Exporter, type ExporterClass, type ExporterSettings, FFmpegExporterClient, type FfmpegExporterOptions, FlagDispatcher, type FullSceneDescription, GeneratorScene, type ImageDataSource, ImageExporter, type ImageExporterOptions, type Inspectable, type InspectedAttributes, type InspectedElement, type InterpolationFunction, JumpSpring, LifecycleEvents, LogLevel, type LogPayload, Logger, type LoopCallback, Matrix2D, Origin, type PartialUserProjectSettings, PlaybackManager, PlaybackState, PlaybackStatus, Player, type PlayerSettings, type PlayerState, PlopSpring, type Plugin, type PossibleBBox, type PossibleColor, type PossibleMatrix2D, type PossibleSpacing, type PossibleVector2, type Project, type ProjectSettings, type Promisable, type PromiseHandle, RAD2DEG, Random, type RectSignal, type Reference, type ReferenceArray, type ReferenceMap, type ReferenceReceiver, type RefsProperty, type RenderVideoUserProjectSettings, Renderer, RendererResult, type RendererSettings, RendererState, type Scene, type SceneConstructor, type SceneDescription, type SceneDescriptionReload, SceneRenderEvent, SceneState, Semaphore, type SerializedBBox, type SerializedColor, type SerializedSpacing, type SerializedVector2, Shaders, SharedWebGLContext, type Signal, SignalContext, type SignalExtensions, type SignalGenerator, type SignalGetter, type SignalSetter, type SignalTween, type SignalValue, type SimpleSignal, type SimpleVector2Signal, type Slide, Slides, SmoothSpring, Spacing, type SpacingSignal, type Spring, Stage, type StageSettings, StrikeSpring, Subscribable, type SubscribableAsyncEvent, type SubscribableEvent, type SubscribableFlagEvent, SubscribableValueEvent, SwingSpring, Thread, type ThreadGenerator, type ThreadGeneratorFactory, type Threadable, type ThreadsCallback, type ThreadsFactory, type TimingFunction, type Type, UNIFORM_DELTA_TIME, UNIFORM_DESTINATION_MATRIX, UNIFORM_DESTINATION_TEXTURE, UNIFORM_FRAME, UNIFORM_FRAMERATE, UNIFORM_RESOLUTION, UNIFORM_SOURCE_MATRIX, UNIFORM_SOURCE_TEXTURE, UNIFORM_TIME, type UserProject, type UserProjectSettings, ValueDispatcher, Variables, Vector2, type Vector2Signal, type Versions, WasmEffectsExporter, WasmExporter, type WebGLContextOwner, type WebGLConvertible, addEditorToProject, all, any, arcLerp, beginSlide, boolLerp, cancel, capitalize, chain, clamp, clampRemap, cos, createComputed, createComputedAsync, createEaseInBack, createEaseInBounce, createEaseInElastic, createEaseInOutBack, createEaseInOutBounce, createEaseInOutElastic, createEaseOutBack, createEaseOutBounce, createEaseOutElastic, createRef, createRefArray, createRefMap, createSignal, createVersionObject, debug, decorate, deepLerp, defaultUserProjectSettings, delay, deprecate, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, endPlayback, endScene, endThread, errorToLog, every, experimentalFeatures, experimentalLog, fadeTransition, finishScene, flipOrigin, getContext, getFullPreviewSettings, getFullRenderingSettings, getImageData, getTaskName, isInspectable, isPromisable, isPromise, isReactive, isThreadGenerator, isThreadable, isType, join, lazy, linear, loadAnimation, loadImage, loop, loopFor, makePlugin, makeProject, makeRef, makeRefs, makeSpring, map, modify, noop, originToOffset, range, remap, rotateVector, run, sequence, setTaskName, sin, slideTransition, spawn, spring, startPlayback, startScene, startThread, textLerp, threadable, threads, transformAngle, transformScalar, transformVector, transformVectorAsPoint, tween, unwrap, useContext, useContextAfter, useLogger, usePlayback, useScene, useThread, useTime, useTransition, waitFor, zoomInTransition, zoomOutTransition };
|
package/dist/index.js
CHANGED
|
@@ -1356,6 +1356,120 @@ _WasmExporter.id = "@twick/core/wasm";
|
|
|
1356
1356
|
_WasmExporter.displayName = "Video (Wasm)";
|
|
1357
1357
|
var WasmExporter = _WasmExporter;
|
|
1358
1358
|
|
|
1359
|
+
// src/exporter/WasmEffectsExporter.ts
|
|
1360
|
+
import {
|
|
1361
|
+
applyEffects,
|
|
1362
|
+
createEffectContext
|
|
1363
|
+
} from "@twick/gl-runtime";
|
|
1364
|
+
var _WasmEffectsExporter = class _WasmEffectsExporter {
|
|
1365
|
+
constructor(project, settings, inner) {
|
|
1366
|
+
this.project = project;
|
|
1367
|
+
this.settings = settings;
|
|
1368
|
+
this.inner = inner;
|
|
1369
|
+
this.effectGlCanvas = null;
|
|
1370
|
+
this.effectContext = null;
|
|
1371
|
+
this.effectReadbackFbo = null;
|
|
1372
|
+
}
|
|
1373
|
+
static async create(project, settings) {
|
|
1374
|
+
const inner = await WasmExporter.create(project, settings);
|
|
1375
|
+
return new _WasmEffectsExporter(project, settings, inner);
|
|
1376
|
+
}
|
|
1377
|
+
async start() {
|
|
1378
|
+
return this.inner.start();
|
|
1379
|
+
}
|
|
1380
|
+
async handleFrame(canvas, frame, sceneFrame, sceneName, signal) {
|
|
1381
|
+
const variables = this.project.variables;
|
|
1382
|
+
const fps = this.settings.fps ?? this.project.settings.rendering.fps ?? 30;
|
|
1383
|
+
const activeEffects = this.project.getActiveEffectsForFrame?.(variables ?? {}, frame, fps) ?? [];
|
|
1384
|
+
if (activeEffects.length === 0) {
|
|
1385
|
+
return this.inner.handleFrame(canvas, frame, sceneFrame, sceneName, signal);
|
|
1386
|
+
}
|
|
1387
|
+
const w = canvas.width;
|
|
1388
|
+
const h = canvas.height;
|
|
1389
|
+
if (w <= 0 || h <= 0) {
|
|
1390
|
+
return this.inner.handleFrame(canvas, frame, sceneFrame, sceneName, signal);
|
|
1391
|
+
}
|
|
1392
|
+
if (!this.effectGlCanvas) {
|
|
1393
|
+
this.effectGlCanvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(w, h) : document.createElement("canvas");
|
|
1394
|
+
this.effectGlCanvas.width = w;
|
|
1395
|
+
this.effectGlCanvas.height = h;
|
|
1396
|
+
}
|
|
1397
|
+
const glCanvas = this.effectGlCanvas;
|
|
1398
|
+
if (glCanvas.width !== w || glCanvas.height !== h) {
|
|
1399
|
+
glCanvas.width = w;
|
|
1400
|
+
glCanvas.height = h;
|
|
1401
|
+
}
|
|
1402
|
+
if (!this.effectContext) {
|
|
1403
|
+
this.effectContext = createEffectContext(glCanvas);
|
|
1404
|
+
}
|
|
1405
|
+
const gl = this.effectContext.gl;
|
|
1406
|
+
const sourceTexture = gl.createTexture();
|
|
1407
|
+
if (!sourceTexture) {
|
|
1408
|
+
return this.inner.handleFrame(canvas, frame, sceneFrame, sceneName, signal);
|
|
1409
|
+
}
|
|
1410
|
+
gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
|
|
1411
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
1412
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
1413
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
1414
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
1415
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
1416
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);
|
|
1417
|
+
const resultTexture = applyEffects({
|
|
1418
|
+
ctx: this.effectContext,
|
|
1419
|
+
sourceTexture,
|
|
1420
|
+
width: w,
|
|
1421
|
+
height: h,
|
|
1422
|
+
effects: activeEffects
|
|
1423
|
+
});
|
|
1424
|
+
gl.deleteTexture(sourceTexture);
|
|
1425
|
+
if (!this.effectReadbackFbo) {
|
|
1426
|
+
this.effectReadbackFbo = gl.createFramebuffer();
|
|
1427
|
+
}
|
|
1428
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this.effectReadbackFbo);
|
|
1429
|
+
gl.framebufferTexture2D(
|
|
1430
|
+
gl.FRAMEBUFFER,
|
|
1431
|
+
gl.COLOR_ATTACHMENT0,
|
|
1432
|
+
gl.TEXTURE_2D,
|
|
1433
|
+
resultTexture,
|
|
1434
|
+
0
|
|
1435
|
+
);
|
|
1436
|
+
const pixels = new Uint8Array(w * h * 4);
|
|
1437
|
+
gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
|
|
1438
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
1439
|
+
const outCanvas = document.createElement("canvas");
|
|
1440
|
+
outCanvas.width = w;
|
|
1441
|
+
outCanvas.height = h;
|
|
1442
|
+
const ctx2d = outCanvas.getContext("2d");
|
|
1443
|
+
if (ctx2d) {
|
|
1444
|
+
const imageData = ctx2d.createImageData(w, h);
|
|
1445
|
+
const rowBytes = w * 4;
|
|
1446
|
+
for (let y = 0; y < h; y++) {
|
|
1447
|
+
imageData.data.set(
|
|
1448
|
+
pixels.subarray((h - 1 - y) * rowBytes, (h - y) * rowBytes),
|
|
1449
|
+
y * rowBytes
|
|
1450
|
+
);
|
|
1451
|
+
}
|
|
1452
|
+
ctx2d.putImageData(imageData, 0, 0);
|
|
1453
|
+
}
|
|
1454
|
+
return this.inner.handleFrame(outCanvas, frame, sceneFrame, sceneName, signal);
|
|
1455
|
+
}
|
|
1456
|
+
async stop(result) {
|
|
1457
|
+
return this.inner.stop?.();
|
|
1458
|
+
}
|
|
1459
|
+
async generateAudio(assets, startFrame, endFrame) {
|
|
1460
|
+
return this.inner.generateAudio?.(assets, startFrame, endFrame);
|
|
1461
|
+
}
|
|
1462
|
+
async mergeMedia() {
|
|
1463
|
+
return this.inner.mergeMedia?.();
|
|
1464
|
+
}
|
|
1465
|
+
async downloadVideos(assets) {
|
|
1466
|
+
return this.inner.downloadVideos?.(assets);
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
_WasmEffectsExporter.id = "@twick/core/wasm-effects";
|
|
1470
|
+
_WasmEffectsExporter.displayName = "Video (Wasm + Effects)";
|
|
1471
|
+
var WasmEffectsExporter = _WasmEffectsExporter;
|
|
1472
|
+
|
|
1359
1473
|
// src/plugin/makePlugin.ts
|
|
1360
1474
|
function makePlugin(plugin) {
|
|
1361
1475
|
return typeof plugin === "function" ? plugin : () => plugin;
|
|
@@ -4777,7 +4891,8 @@ var Renderer = class {
|
|
|
4777
4891
|
const exporters = [
|
|
4778
4892
|
FFmpegExporterClient,
|
|
4779
4893
|
ImageExporter,
|
|
4780
|
-
WasmExporter
|
|
4894
|
+
WasmExporter,
|
|
4895
|
+
WasmEffectsExporter
|
|
4781
4896
|
];
|
|
4782
4897
|
const exporterClass = exporters.find(
|
|
4783
4898
|
(exporter) => exporter.id === settings.exporter.name
|
|
@@ -6090,6 +6205,7 @@ export {
|
|
|
6090
6205
|
ValueDispatcher,
|
|
6091
6206
|
Variables,
|
|
6092
6207
|
Vector2,
|
|
6208
|
+
WasmEffectsExporter,
|
|
6093
6209
|
WasmExporter,
|
|
6094
6210
|
addEditorToProject,
|
|
6095
6211
|
all,
|