UNPKG

libpag

Version:
68 lines (67 loc) 2.17 kB
import type { WorkerPAGFile } from './pag-file'; import type { PAGViewOptions } from '../pag-view'; import type { DebugData, PAGScaleMode } from '../types'; export declare class WorkerPAGView { /** * Create pag view. * @param file pag file. * @param canvas target render canvas. * @param initOptions pag view options * @returns */ static init(file: WorkerPAGFile, canvas: HTMLCanvasElement, initOptions?: PAGViewOptions): Promise<WorkerPAGView>; key: number; worker: Worker; isDestroyed: boolean; constructor(worker: Worker, key: number); /** * The duration of current composition in microseconds. */ duration(): Promise<number>; /** * Start the animation. */ play(): Promise<any>; /** * Pause the animation. */ pause(): Promise<void>; /** * Stop the animation. */ stop(): Promise<void>; /** * Set the number of times the animation will repeat. The default is 1, which means the animation * will play only once. 0 means the animation will play infinity times. */ setRepeatCount(repeatCount: number): Promise<void>; /** * Returns the current progress of play position, the value is from 0.0 to 1.0. It is applied only * when the composition is not null. */ getProgress(): Promise<number>; /** * Returns the current frame. */ currentFrame(): Promise<number>; /** * Set the progress of play position, the value is from 0.0 to 1.0. */ setProgress(progress: number): Promise<any>; /** * Returns the current scale mode. */ scaleMode(): Promise<number>; /** * Specifies the rule of how to scale the pag content to fit the surface size. The matrix * changes when this method is called. */ setScaleMode(value: PAGScaleMode): Promise<void>; /** * Call this method to render current position immediately. If the play() method is already * called, there is no need to call it. Returns true if the content has changed. */ flush(): Promise<boolean>; getDebugData(): Promise<DebugData>; destroy(): void; }