@diffusionstudio/core-v4
Version:
A fast, browser based video compositing engine powered by WebCodecs
154 lines (153 loc) • 5.04 kB
TypeScript
import { Clip } from '../clip';
import { TextPrimitive, TextPrimitiveState } from '../../primitives';
import { Layer } from '../../layer';
import { hex, Percent, Time } from '../../types';
import { CaptionsClipProps, CaptionPreset } from './interfaces';
import { Renderer, TextAlign, TextBaseline, TextCase, Glow, Stroke, Shadow, Font, RelativePoint, Point } from '../../renderer';
import { CaptionSource, WordGroup } from '../../sources';
import { CaptionPresetType } from './types';
declare const CaptionClip_base: {
new (...args: any[]): {
source?: {
height: number;
width: number;
aspectRatio: number;
} | undefined;
_position: {
x: number;
y: number;
};
_layoutCache: import('../..').Size;
_height?: number;
_width?: number;
_aspectRatio?: number;
_keepAspectRatio: boolean;
_mask?: import('../..').Mask;
constraints: import('..').Constraints;
anchorX: number;
anchorY: number;
scaleX: number;
scaleY: number;
translateX: number;
translateY: number;
rotation: number;
opacity: number;
effects: import('..').Effect[];
blendMode?: import('../..').BlendMode;
get x(): number;
set x(value: number | Percent);
get y(): number;
set y(value: number | Percent);
get filter(): string;
get translate(): Point;
set translate(value: Point | number);
get anchor(): Point;
set anchor(value: Point | number);
get scale(): Point;
set scale(value: Point | number);
get mask(): import('../..').Mask | undefined;
set mask(value: import('../..').Mask | undefined);
get keepAspectRatio(): boolean;
set keepAspectRatio(value: boolean);
get aspectRatio(): number;
set aspectRatio(value: number | undefined);
get height(): number;
set height(value: Percent | number | undefined);
get width(): number;
set width(value: Percent | number | undefined);
get position(): Point;
set position(value: RelativePoint | "center");
animate(time: number): /*elided*/ any;
layout(next: import('../..').Size): void;
get size(): import('../..').Size;
get bounds(): [Point, Point, Point, Point];
animations: import('..').ClipAnimationOptions;
start: number;
end: number;
toJSON(exclude?: string[]): unknown;
fromJSON<K = {}>(obj: K extends string ? never : K): /*elided*/ any;
};
readonly VISUAL_MIXIN: symbol;
} & typeof Clip;
export declare class CaptionClip extends CaptionClip_base {
state: TextPrimitiveState;
readonly type = "CAPTION";
layer?: Layer<CaptionClip>;
source?: CaptionSource;
private _range;
node: TextPrimitive | null;
currentText: string | null;
preset: CaptionPreset<CaptionPresetType>;
/**
* The width at which text will wrap
*/
maxWidth: number | Percent | undefined;
constructor(source?: CaptionSource, props?: CaptionsClipProps);
init(source?: CaptionSource): Promise<void>;
get range(): [number, number];
set range(value: [Time | undefined, Time | undefined]);
get start(): number;
set start(time: Time);
get end(): number;
set end(time: Time);
get duration(): number;
get groups(): WordGroup[];
set duration(time: Time);
trim(start?: Time, end?: Time): this;
split(time?: Time): Promise<this>;
/**
* A fillstyle that will be used on the text '#00FF00'.
*/
get color(): hex;
set color(value: hex);
/**
* The font to use for the text.
*/
get font(): Font;
set font(value: Font);
/**
* The casing of the text, e.g. uppercase
*/
get casing(): TextCase;
set casing(value: TextCase);
/**
* Alignment for multiline text, does not affect single line text.
*/
get align(): TextAlign;
set align(value: TextAlign);
/**
* The baseline of the text that is rendered.
*/
get baseline(): TextBaseline;
set baseline(value: TextBaseline);
get strokes(): Stroke[];
set strokes(value: Stroke[]);
get shadows(): Shadow[];
set shadows(value: Shadow[]);
/**
* The space between lines
*/
get leading(): number;
set leading(value: number);
/**
* An object describing the glow to apply
*/
get glow(): Glow | undefined;
set glow(value: Glow | undefined);
loadPreset(type: CaptionPresetType): Promise<void>;
render(renderer: Renderer): void;
get width(): number;
set width(value: number);
get height(): number;
set height(_value: number);
/**
* Proxy for font.size
*/
get fontSize(): number;
set fontSize(value: number);
get name(): string;
get position(): Point;
set position(value: RelativePoint | 'center');
clearCache(): void;
}
export {};