UNPKG

tav-media

Version:

Cross platform media editing framework

116 lines (115 loc) 4.18 kB
import { PAGAsset } from '../assets/tav-pag-asset'; import { tav } from '../tav'; import { ClipReplacement, Matrix, PAGTextReplacement, ScaleMode } from '../types/types'; import { Effect } from './tav-effect'; import { Clip } from '..'; /** * A effect that display PAG file * @category Effects */ export declare class PAGEffect extends Effect { /** * Creates a PAG Effect from a PAG asset, return null if the asset does * not exist or it's not a valid pag asset. */ static MakeFromAsset(asset: PAGAsset): Promise<PAGEffect>; readonly type: string; scaleMode: ScaleMode; private asset?; private _clipReplacements; private _textReplacements; private _matrix; private _timeStretchMode; private _layerMatrixes?; clone(): PAGEffect; release(): void; /** * Add a clip to replace a editable image layer with scale mode. * @param clip The clip used as an effect input. * @param scaleMode Set how the clip is scaled to fit the layer. * @param editableIndex The index of the editable layer in the PAG file. */ addInput(clip: Clip, scaleMode?: ScaleMode, editableIndex?: number): void; removeInput(clip: Clip): void; removeAllInputs(): void; /** * Add a clip to replace a editable image layer with a matrix. * @param clip The clip used as an effect input. * @param editableIndex The index of the editable layer in the PAG file. * @param matrix The matrix used to transform the clip to fit the layer. */ addInputMatrix(clip: Clip, editableIndex: number, matrix: Matrix): void; /** * Set a new matrix to the input clip. * @param editableIndex The index of the editable layer in the PAG file. * @param clipIndex The index of the clip in the inputs. * @param matrix The new matrix. */ replaceClipMatrix(editableIndex: number, clipIndex: number, matrix: Matrix): void; /** * Set a new matrix to a existing PAG layer. * @param layerName The name of the layer in the PAG file. * @param matrix The new matrix. */ replaceLayerMatrix(layerName: string, matrix: Matrix): void; /** * Get editable text layers infos. * @param name The name of the layer. Get all editable texts when the name is empty. */ getEditableTextInfo(name?: string): tav.PAGTextEditableInfos; /** * Get editable image layers infos. * @param name The name of the layer. Get all editable texts when the name is empty. */ getEditableImageInfos(name?: string): tav.PAGImageEditableInfos; protected createClip(): Promise<tav.PAGEffect> | undefined; protected updateClip(effect: tav.PAGEffect): Promise<void>; /** * Get a list of ClipReplacement to replace images in the PAG file, * The ClipReplacements are added by addInput or addInputMatrix. */ get clipReplacements(): ClipReplacement[]; /** * Get or set a list of PAGTextReplacement to replace texts in the PAG file */ get textReplacements(): PAGTextReplacement[]; set textReplacements(textReps: PAGTextReplacement[]); /** * Get or set the matrix of this effect. */ get matrix(): Readonly<Matrix>; set matrix(matrix: Readonly<Matrix>); /** * The count of replaceable images. */ get numImages(): number; /** * The count of replaceable texts. */ get numTexts(): number; /** * Get the width of the effect. */ get width(): number; /** * Get the width of the effect. */ get height(): number; /** * Get the text data of the specified layer index. * @param editableIndex The index of the text layer. */ getTextAttribute(editableIndex: number): tav.TAVTextAttribute; /** * Get the duration of the PAG file. */ get fileDuration(): number; /** * Get or set the time stretch mode of the PAG file. * PAGEffect will stretch the PAG file to fit the duration of the PAGEffect. */ get timeStretchMode(): tav.PAGTimeStretchMode; set timeStretchMode(mode: tav.PAGTimeStretchMode); private updateMatrix; private replaceTexts; }