This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 240
/
index.d.ts
71 lines (58 loc) · 2.31 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
export as namespace SVGA;
declare global {
const SVGA: {
VideoEntity: typeof VideoEntity,
Parser: typeof Parser,
Player: typeof Player,
CreatejsPlayer: typeof CreatejsPlayer,
LayaboxPlayer: typeof LayaboxPlayer,
}
}
export class VideoEntity {
videoSize: { width: number, height: number }
FPS: number
frames: number
}
export class Parser {
load(url: string, success: (videoItem: VideoEntity) => void, failure?: (err: Error) => void): void
}
export class Player {
loops: number;
clearsAfterStop: boolean;
fillMode: "Forward" | "Backward"
constructor(canvas: string | HTMLCanvasElement | HTMLDivElement)
setVideoItem(videoItem: VideoEntity): void
setContentMode(contentMode: "Fill" | "AspectFill" | "AspectFit"): void
setClipsToBounds(clipsToBounds: boolean): void
startAnimation(reverse?: boolean): void
startAnimationWithRange(range: {location: number, length: number}, reverse?: boolean): void
pauseAnimation(): void
stopAnimation(clear?: boolean): void
clear(): void
stepToFrame(frame: number, andPlay?: boolean): void
stepToPercentage(percentage: number, andPlay?: boolean): void
setImage(urlORbase64: string, forKey: string, transform?: number[]): void
setText(textORMap: string | {
text: string,
size?: string,
family?: string,
color?: string,
offset?: { x: number, y: number }
}, forKey: string): void
clearDynamicObjects(): void
onFinished(callback: () => void): void
onFrame(callback: (frame: number) => void): void
onPercentage(callback: (percentage: number) => void): void
drawOnContext(ctx: CanvasRenderingContext2D, x: number, y: number, width?: number, height?: number): void
}
export class CreatejsPlayer extends Player {
constructor(url: string, autoplay?: boolean)
onError(callback: (error: Error) => void): void
setFrame(x: number, y: number, width: number, height: number): void
}
export class LayaboxPlayer extends Player {
constructor(url?: string, autoplay?: boolean)
setVideoUrl(url?: string, autoplay?: boolean, success?: (videoItem: VideoEntity) => void, failure?: (error: Error) => void): void;
onError(callback: (error: Error) => void): void
setFrame(x: number, y: number, width: number, height: number): void
}