New textstream
Browse files
Remotion-app/src/HelloWorld/TextStream.jsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import React, {createElement} from 'react';
|
2 |
-
import {useVideoConfig} from 'remotion';
|
3 |
import * as Fonts from '@remotion/google-fonts';
|
4 |
import transcriptData from './Assets/TextSequences.json';
|
5 |
import {FONT_FAMILY} from './constants';
|
@@ -36,36 +36,39 @@ export const TextStream = () => {
|
|
36 |
const {fps} = useVideoConfig();
|
37 |
|
38 |
return (
|
39 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
<TransitionSeries>
|
41 |
{transcriptData.map((entry, index) => {
|
42 |
-
const duration =
|
43 |
-
fps * (entry.end - entry.start) > 1
|
44 |
-
? fps * (entry.end - entry.start)
|
45 |
-
: 1;
|
46 |
-
|
47 |
return (
|
48 |
<TransitionSeries.Sequence
|
|
|
49 |
key={index}
|
50 |
from={entry.start * fps}
|
51 |
-
durationInFrames={
|
52 |
>
|
53 |
-
<Letter index={index} color="#0b84f3">
|
54 |
{entry.text}
|
55 |
</Letter>
|
56 |
</TransitionSeries.Sequence>
|
57 |
);
|
58 |
})}
|
59 |
</TransitionSeries>
|
60 |
-
</
|
61 |
);
|
62 |
};
|
63 |
|
64 |
-
export function Letter({children, color, index}) {
|
65 |
-
|
66 |
-
return createElement(
|
67 |
-
'div',
|
68 |
-
{className: 'greeting', style: {...x, color: 'white'}},
|
69 |
-
children
|
70 |
-
);
|
71 |
}
|
|
|
1 |
import React, {createElement} from 'react';
|
2 |
+
import {useVideoConfig, AbsoluteFill, TransitionSeries} from 'remotion';
|
3 |
import * as Fonts from '@remotion/google-fonts';
|
4 |
import transcriptData from './Assets/TextSequences.json';
|
5 |
import {FONT_FAMILY} from './constants';
|
|
|
36 |
const {fps} = useVideoConfig();
|
37 |
|
38 |
return (
|
39 |
+
<AbsoluteFill
|
40 |
+
style={{
|
41 |
+
backgroundColor: 'transparent',
|
42 |
+
justifyContent: 'center',
|
43 |
+
alignItems: 'center',
|
44 |
+
position: 'relative',
|
45 |
+
color: 'white',
|
46 |
+
fontSize: 120,
|
47 |
+
fontFamily: FONT_FAMILY,
|
48 |
+
fontWeight: 'bolder',
|
49 |
+
WebkitBackfaceVisibility: 'hidden',
|
50 |
+
}}
|
51 |
+
>
|
52 |
<TransitionSeries>
|
53 |
{transcriptData.map((entry, index) => {
|
|
|
|
|
|
|
|
|
|
|
54 |
return (
|
55 |
<TransitionSeries.Sequence
|
56 |
+
style={subtitle}
|
57 |
key={index}
|
58 |
from={entry.start * fps}
|
59 |
+
durationInFrames={fps * (entry.end - entry.start) + 1}
|
60 |
>
|
61 |
+
<Letter style={subtitle} index={index} color="#0b84f3">
|
62 |
{entry.text}
|
63 |
</Letter>
|
64 |
</TransitionSeries.Sequence>
|
65 |
);
|
66 |
})}
|
67 |
</TransitionSeries>
|
68 |
+
</AbsoluteFill>
|
69 |
);
|
70 |
};
|
71 |
|
72 |
+
export function Letter({children, color, index, style}) {
|
73 |
+
return createElement('div', {style: style}, children);
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|