Captions
Time-synced captions burned into the frame.
// Time-coded captions via addCaptions(typographyProps, { captions: [...] }).
const $ = new VideoFlow({
name: 'Captions Demo',
width: 1920,
height: 1080,
fps: 30,
backgroundColor: '#0d0d1a',
});
$.addCaptions(
// Shared typography across every line.
{
fontSize: 3.5,
fontWeight: 700,
color: '#ffffff',
position: [0.5, 0.82],
textAlign: 'center',
},
// startTime/endTime are absolute seconds.
{
captions: [
{ caption: 'Welcome to VideoFlow.', startTime: 0, endTime: 1.5 },
{ caption: 'Build videos from code.', startTime: 1.5, endTime: 3 },
{ caption: 'No editor required.', startTime: 3, endTime: 5 },
{ caption: 'Just write JavaScript.', startTime: 5, endTime: 7.5 },
],
maxCharsPerLine: 35,
maxLines: 2,
},
);
// addCaptions doesn't advance the flow pointer; wait covers the full track.
$.wait('7.5s');
return $;