-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path01-basic-text.ts
More file actions
51 lines (44 loc) · 986 Bytes
/
01-basic-text.ts
File metadata and controls
51 lines (44 loc) · 986 Bytes
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
/**
* Example 01 — Basic Text Video
*
* 5-second card with a title that fades in (with a subtle scale up), holds,
* and fades out (scaling slightly past 1). Demonstrates `addText` + `animate`.
*
* Run:
* npx tsx examples/01-basic-text.ts
*/
import VideoFlow from '@videoflow/core';
export function createProject() {
const $ = new VideoFlow({
name: 'Basic Text',
width: 1920,
height: 1080,
fps: 30,
});
const title = $.addText({
text: 'Hello, VideoFlow!',
fontSize: 9,
fontWeight: 800,
color: '#ffffff',
});
title.animate(
{ opacity: 0, scale: 0.8 },
{ opacity: 1, scale: 1 },
{ duration: '0.8s' },
);
$.wait('1.5s');
title.animate(
{ opacity: 1, scale: 1 },
{ opacity: 0, scale: 1.2 },
{ duration: '0.8s' },
);
return $;
}
if (typeof window === 'undefined') {
await createProject().renderVideo({
outputType: 'file',
output: './01-basic-text.mp4',
verbose: true,
});
console.log('Done → examples/01-basic-text.mp4');
}