1 | interface Comment {
|
2 | text?: string;
|
3 | |
4 |
|
5 |
|
6 | mode?: 'ltr' | 'rtl' | 'top' | 'bottom';
|
7 | |
8 |
|
9 |
|
10 |
|
11 | time?: number;
|
12 | style?: Partial<CSSStyleDeclaration> | CanvasRenderingContext2D;
|
13 | |
14 |
|
15 |
|
16 |
|
17 | render?(): HTMLElement | HTMLCanvasElement;
|
18 | }
|
19 |
|
20 | interface DanmakuOption {
|
21 | |
22 |
|
23 |
|
24 | container: HTMLElement;
|
25 | |
26 |
|
27 |
|
28 | media?: HTMLMediaElement;
|
29 | |
30 |
|
31 |
|
32 | comments?: Comment[];
|
33 | |
34 |
|
35 |
|
36 |
|
37 | engine?: 'dom' | 'canvas';
|
38 | |
39 |
|
40 |
|
41 | speed?: number;
|
42 | }
|
43 |
|
44 | declare class Danmaku {
|
45 | constructor(option: DanmakuOption);
|
46 | /**
|
47 | * The speed of comments in `ltr` and `rtl` mode.
|
48 | */
|
49 | get speed(): number;
|
50 | set speed(s: number);
|
51 | /**
|
52 | * Destroy the instance and release memory.
|
53 | */
|
54 | destroy(): Danmaku;
|
55 | emit(comment: Comment): Danmaku;
|
56 | show(): Danmaku;
|
57 | hide(): Danmaku;
|
58 | /**
|
59 | * Clear current stage.
|
60 | */
|
61 | clear(): Danmaku;
|
62 | /**
|
63 | * Do it when you resize container.
|
64 | */
|
65 | resize(): Danmaku;
|
66 | }
|
67 |
|
68 | export default Danmaku;
|