faster rendering
Browse files
Remotion-app/src/HelloWorld/ImageStream.jsx
CHANGED
@@ -1,12 +1,17 @@
|
|
1 |
import {AbsoluteFill} from 'remotion';
|
2 |
|
3 |
import React, {useMemo} from 'react';
|
4 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import imageSequences from './Assets/ImageSequences.json';
|
6 |
import {TransitionSeries, linearTiming} from '@remotion/transitions';
|
7 |
-
import GsapAnimation from './Components/GsapAnimation';
|
8 |
-
import gsap from 'gsap';
|
9 |
-
import {MotionPathPlugin} from 'gsap-trial/all';
|
10 |
|
11 |
const ImageStream = React.memo(() => {
|
12 |
const {fps} = useVideoConfig();
|
@@ -43,50 +48,28 @@ const ImageStream = React.memo(() => {
|
|
43 |
});
|
44 |
|
45 |
const Images = React.memo(({entry, index}) => {
|
46 |
-
const
|
47 |
-
|
48 |
-
const gsapTimeline = () => {
|
49 |
-
let tlContainer = gsap.timeline();
|
50 |
-
// tlContainer.fromTo(
|
51 |
-
// '#gaussianBlur',
|
52 |
-
// {
|
53 |
-
// attr: {stdDeviation: `250,0`},
|
54 |
-
// },
|
55 |
-
// {
|
56 |
-
// attr: {stdDeviation: `0,0`},
|
57 |
-
|
58 |
-
// duration: 1 / 2,
|
59 |
-
// },
|
60 |
-
// 0
|
61 |
-
// );
|
62 |
-
tlContainer.to('#imagex', {
|
63 |
-
duration: 2, // Total duration for one loop
|
64 |
-
ease: 'power1.inOut',
|
65 |
-
scale: 1.2,
|
66 |
-
// motionPath: {
|
67 |
-
// path: CAMERA_PATHS[index % CAMERA_PATHS.length],
|
68 |
-
// align: '#imagex',
|
69 |
-
// alignOrigin: [0.5, 0.5],
|
70 |
-
// autoRotate: false,
|
71 |
-
// },
|
72 |
-
});
|
73 |
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
76 |
|
77 |
return (
|
78 |
-
<
|
79 |
-
plugins={plugins}
|
80 |
style={{
|
81 |
BackgroundColor: 'black',
|
82 |
}}
|
83 |
className="bg-black"
|
84 |
-
Timeline={gsapTimeline}
|
85 |
>
|
86 |
<Audio src={staticFile('sfx_1.mp3')} />
|
87 |
<Img
|
88 |
id="imagex"
|
89 |
style={{
|
|
|
90 |
filter: `url(#blur)`,
|
91 |
objectPosition: 'center',
|
92 |
objectFit: 'cover',
|
@@ -94,14 +77,13 @@ const Images = React.memo(({entry, index}) => {
|
|
94 |
position: 'absolute',
|
95 |
top: '50%', // Center vertically
|
96 |
left: '50%', // Center horizontally
|
97 |
-
transform:
|
98 |
-
|
99 |
width: 1080,
|
100 |
height: 1920,
|
101 |
}}
|
102 |
src={staticFile(entry.name)}
|
103 |
/>
|
104 |
-
</
|
105 |
);
|
106 |
});
|
107 |
|
|
|
1 |
import {AbsoluteFill} from 'remotion';
|
2 |
|
3 |
import React, {useMemo} from 'react';
|
4 |
+
import {
|
5 |
+
staticFile,
|
6 |
+
useVideoConfig,
|
7 |
+
Img,
|
8 |
+
Easing,
|
9 |
+
Audio,
|
10 |
+
useCurrentFrame,
|
11 |
+
interpolate,
|
12 |
+
} from 'remotion';
|
13 |
import imageSequences from './Assets/ImageSequences.json';
|
14 |
import {TransitionSeries, linearTiming} from '@remotion/transitions';
|
|
|
|
|
|
|
15 |
|
16 |
const ImageStream = React.memo(() => {
|
17 |
const {fps} = useVideoConfig();
|
|
|
48 |
});
|
49 |
|
50 |
const Images = React.memo(({entry, index}) => {
|
51 |
+
const frame = useCurrentFrame();
|
52 |
+
const {fps} = useVideoConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
const duration = fps * 2.5;
|
55 |
+
const ImgScale = interpolate(frame, [1, duration], [1, 1.2], {
|
56 |
+
easing: Easing.bezier(0.65, 0, 0.35, 1),
|
57 |
+
extrapolateRight: 'clamp',
|
58 |
+
extrapolateLeft: 'clamp',
|
59 |
+
});
|
60 |
|
61 |
return (
|
62 |
+
<AbsoluteFill
|
|
|
63 |
style={{
|
64 |
BackgroundColor: 'black',
|
65 |
}}
|
66 |
className="bg-black"
|
|
|
67 |
>
|
68 |
<Audio src={staticFile('sfx_1.mp3')} />
|
69 |
<Img
|
70 |
id="imagex"
|
71 |
style={{
|
72 |
+
scale: 2,
|
73 |
filter: `url(#blur)`,
|
74 |
objectPosition: 'center',
|
75 |
objectFit: 'cover',
|
|
|
77 |
position: 'absolute',
|
78 |
top: '50%', // Center vertically
|
79 |
left: '50%', // Center horizontally
|
80 |
+
transform: `translate(-50%, -50%) scale(${ImgScale})`,
|
|
|
81 |
width: 1080,
|
82 |
height: 1920,
|
83 |
}}
|
84 |
src={staticFile(entry.name)}
|
85 |
/>
|
86 |
+
</AbsoluteFill>
|
87 |
);
|
88 |
});
|
89 |
|
Remotion-app/src/HelloWorld/TextStream.jsx
CHANGED
@@ -47,13 +47,12 @@ const TextStream = React.memo(() => {
|
|
47 |
>
|
48 |
<TransitionSeries>
|
49 |
{memoizedTranscriptData.map((entry, index) => {
|
50 |
-
const delta = entry.end - entry.start < 1 / 30 ? 0.2 : 0;
|
51 |
return (
|
52 |
<TransitionSeries.Sequence
|
53 |
style={subtitle}
|
54 |
key={index}
|
55 |
-
from={
|
56 |
-
durationInFrames={fps * (entry.end - entry.start
|
57 |
>
|
58 |
<Letter style={subtitle}>{entry.text}</Letter>
|
59 |
</TransitionSeries.Sequence>
|
|
|
47 |
>
|
48 |
<TransitionSeries>
|
49 |
{memoizedTranscriptData.map((entry, index) => {
|
|
|
50 |
return (
|
51 |
<TransitionSeries.Sequence
|
52 |
style={subtitle}
|
53 |
key={index}
|
54 |
+
from={entry.start * fps}
|
55 |
+
durationInFrames={fps * (entry.end - entry.start)}
|
56 |
>
|
57 |
<Letter style={subtitle}>{entry.text}</Letter>
|
58 |
</TransitionSeries.Sequence>
|