Mbonea commited on
Commit
57155b1
·
1 Parent(s): 448aa60

Absolute fill

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