Skip to content

🎥 Make videos programmatically with React

Keep Freeze optimization scoped to core

Jonny Burger61483e446393
diff --git a/packages/example/src/WhatsNew/WhatsNew.tsx b/packages/example/src/WhatsNew/WhatsNew.tsx
index 6221a9e278..8641593405 100644
--- a/packages/example/src/WhatsNew/WhatsNew.tsx
+++ b/packages/example/src/WhatsNew/WhatsNew.tsx
@@ -14,28 +14,11 @@ import {SneakPeekScene} from './scenes/SneakPeek';
import {SoundEffectsScene} from './scenes/SoundEffects';
import {VercelScene} from './scenes/Vercel';
-const Score: React.FC = () => {
- const frame = useCurrentFrame();
-
- return (
- <Audio
- name="Score"
- src={
- 'https://remotion.media/announcements/whats-new-in-remotion/cursor/music/score.wav'
- }
- volume={interpolate(
- frame,
- [0, 16, 106, 114, 204, 226, 6250, 6280, 7160, 7172, 7296, 7328],
- [0, 0.3, 0.3, 0.55, 0.55, 0.13, 0.13, 0.17, 0.17, 0.7, 0.7, 0],
- {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},
- )}
- />
- );
-};
-
// Every scene is a whole number of beats (16 frames at 112.5 BPM), so each
// chapter starts on a downbeat of the score.
export const WhatsNew: React.FC = () => {
+ const frame = useCurrentFrame();
+
return (
<AbsoluteFill style={{backgroundColor: '#000'}}>
<TransitionSeries name="Chapters">
@@ -134,7 +117,18 @@ export const WhatsNew: React.FC = () => {
</TransitionSeries.Sequence>
</TransitionSeries>
- <Score />
+ <Audio
+ name="Score"
+ src={
+ 'https://remotion.media/announcements/whats-new-in-remotion/cursor/music/score.wav'
+ }
+ volume={interpolate(
+ frame,
+ [0, 16, 106, 114, 204, 226, 6250, 6280, 7160, 7172, 7296, 7328],
+ [0, 0.3, 0.3, 0.55, 0.55, 0.13, 0.13, 0.17, 0.17, 0.7, 0.7, 0],
+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},
+ )}
+ />
</AbsoluteFill>
);
};
diff --git a/packages/jonnys-videos/src/roller-skis/Composition.tsx b/packages/jonnys-videos/src/roller-skis/Composition.tsx
index aa52a07e5b..737574e852 100644
--- a/packages/jonnys-videos/src/roller-skis/Composition.tsx
+++ b/packages/jonnys-videos/src/roller-skis/Composition.tsx
@@ -645,38 +645,8 @@ export const PresenterIntroduction: React.FC = () => {
);
};
-const EndCardSequence: React.FC = () => {
- const frame = useCurrentFrame();
- const {fps} = useVideoConfig();
-
- return (
- <Sequence
- name="Jonny Burger YouTube end card"
- from={END_CARD_START}
- durationInFrames={END_CARD_DURATION_IN_FRAMES}
- premountFor={fps}
- >
- <AbsoluteFill
- style={{
- translate: interpolate(
- frame,
- [12115, 12139],
- ['1920px 0px', '0px 0px'],
- {
- easing: [Easing.bezier(0.22, 1, 0.36, 1)],
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- },
- ),
- }}
- >
- <YouTubeEndCard />
- </AbsoluteFill>
- </Sequence>
- );
-};
-
const RollerSkiRoughCut: React.FC = () => {
+ const frame = useCurrentFrame();
const {fps} = useVideoConfig();
return (
@@ -1390,7 +1360,10 @@ const RollerSkiRoughCut: React.FC = () => {
objectFit="cover"
premountFor={fps}
effects={[lut({content: outdoorLut})]}
- volume={1}
+ volume={interpolate(frame, [2697, 2896], [1, 1], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ })}
/>
<BasicCaptions
name="Climbing the incline captions"
@@ -4024,7 +3997,29 @@ const RollerSkiRoughCut: React.FC = () => {
/>
</Series.Sequence>
</Series>
- <EndCardSequence />
+ <Sequence
+ name="Jonny Burger YouTube end card"
+ from={END_CARD_START}
+ durationInFrames={END_CARD_DURATION_IN_FRAMES}
+ premountFor={fps}
+ >
+ <AbsoluteFill
+ style={{
+ translate: interpolate(
+ frame,
+ [12115, 12139],
+ ['1920px 0px', '0px 0px'],
+ {
+ easing: [Easing.bezier(0.22, 1, 0.36, 1)],
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ ),
+ }}
+ >
+ <YouTubeEndCard />
+ </AbsoluteFill>
+ </Sequence>
<Audio
name="No School Today music"
src={rollerSkiAsset('audio/no-school-today-femme-tov.wav')}