Absolute fill
Browse files
Remotion-app/src/HelloWorld/ImageStream.jsx
CHANGED
|
@@ -1,4 +1,10 @@
|
|
| 1 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import React from 'react';
|
| 3 |
import {staticFile, useVideoConfig, Img, Easing} from 'remotion';
|
| 4 |
import {slide} from '@remotion/transitions/slide';
|
|
@@ -10,53 +16,55 @@ export default function ImageStream() {
|
|
| 10 |
|
| 11 |
const frame = useCurrentFrame();
|
| 12 |
return (
|
| 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 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 61 |
);
|
| 62 |
}
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
AbsoluteFill,
|
| 3 |
+
Series,
|
| 4 |
+
interpolate,
|
| 5 |
+
spring,
|
| 6 |
+
useCurrentFrame,
|
| 7 |
+
} from 'remotion';
|
| 8 |
import React from 'react';
|
| 9 |
import {staticFile, useVideoConfig, Img, Easing} from 'remotion';
|
| 10 |
import {slide} from '@remotion/transitions/slide';
|
|
|
|
| 16 |
|
| 17 |
const frame = useCurrentFrame();
|
| 18 |
return (
|
| 19 |
+
<AbsoluteFill>
|
| 20 |
+
<TransitionSeries
|
| 21 |
+
style={{
|
| 22 |
+
top: '50%',
|
| 23 |
+
left: '50%',
|
| 24 |
+
transform: 'translate(-50%, -50%)',
|
| 25 |
+
color: 'white',
|
| 26 |
+
position: 'absolute',
|
| 27 |
+
width: '100%',
|
| 28 |
+
height: '100%',
|
| 29 |
+
zIndex: 0,
|
| 30 |
+
objectFit: 'cover',
|
| 31 |
+
}}
|
| 32 |
+
>
|
| 33 |
+
{imageSequences.map((entry, index) => {
|
| 34 |
+
const durationInFrames = (entry.end - entry.start) * fps;
|
| 35 |
|
| 36 |
+
const zoom = interpolate(
|
| 37 |
+
frame,
|
| 38 |
+
[
|
| 39 |
+
fps * entry.start,
|
| 40 |
+
fps * entry.start + 2 * (durationInFrames / 4),
|
| 41 |
+
fps * entry.end,
|
| 42 |
+
],
|
| 43 |
+
[1, 1.2, 1],
|
| 44 |
+
{
|
| 45 |
+
// easing: Easing.bezier(0.8, 0.22, 0.96, 0.65),
|
| 46 |
+
extrapolateLeft: 'clamp',
|
| 47 |
+
extrapolateRight: 'clamp',
|
| 48 |
+
}
|
| 49 |
+
);
|
| 50 |
|
| 51 |
+
return (
|
| 52 |
+
<TransitionSeries.Sequence
|
| 53 |
+
key={index}
|
| 54 |
+
from={fps * entry.start}
|
| 55 |
+
durationInFrames={fps * (entry.end - entry.start)}
|
| 56 |
+
>
|
| 57 |
+
<Img
|
| 58 |
+
style={{
|
| 59 |
+
transform: `scale(${zoom})`,
|
| 60 |
+
transition: 'all 1s ease',
|
| 61 |
+
}}
|
| 62 |
+
src={staticFile(entry.name)}
|
| 63 |
+
/>
|
| 64 |
+
</TransitionSeries.Sequence>
|
| 65 |
+
);
|
| 66 |
+
})}
|
| 67 |
+
</TransitionSeries>
|
| 68 |
+
</AbsoluteFill>
|
| 69 |
);
|
| 70 |
}
|