performance?
Browse files
Remotion-app/src/HelloWorld/Components/GsapAnimation.jsx
CHANGED
@@ -1,15 +1,24 @@
|
|
1 |
-
import {
|
2 |
-
import {
|
|
|
3 |
import gsap from 'gsap';
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
</AbsoluteFill>
|
14 |
-
);
|
15 |
}
|
|
|
1 |
+
import {useGsapTimeline} from '../../lib/useGsapTimeline';
|
2 |
+
import {AbsoluteFill} from 'remotion';
|
3 |
+
import React, {useMemo} from 'react';
|
4 |
import gsap from 'gsap';
|
5 |
|
6 |
+
export default function GsapAnimation({
|
7 |
+
Timeline,
|
8 |
+
style,
|
9 |
+
className,
|
10 |
+
children,
|
11 |
+
plugins = [],
|
12 |
+
}) {
|
13 |
+
const memoizedPlugins = useMemo(() => {
|
14 |
+
return [...plugins];
|
15 |
+
}, [plugins]);
|
16 |
|
17 |
+
gsap.registerPlugin(memoizedPlugins);
|
18 |
+
const ContainerRef = useGsapTimeline(Timeline);
|
19 |
+
return (
|
20 |
+
<AbsoluteFill className={className} style={style} ref={ContainerRef}>
|
21 |
+
{children}
|
22 |
+
</AbsoluteFill>
|
23 |
+
);
|
|
|
|
|
24 |
}
|
Remotion-app/src/HelloWorld/ImageStream.jsx
CHANGED
@@ -49,8 +49,9 @@ export default function ImageStream() {
|
|
49 |
}
|
50 |
|
51 |
const Images = ({entry, index}) => {
|
52 |
-
const plugins = [MotionPathPlugin];
|
53 |
-
|
|
|
54 |
let tlContainer = gsap.timeline();
|
55 |
// tlContainer.fromTo(
|
56 |
// '#gaussianBlur',
|
@@ -77,7 +78,8 @@ const Images = ({entry, index}) => {
|
|
77 |
});
|
78 |
|
79 |
return tlContainer;
|
80 |
-
};
|
|
|
81 |
return (
|
82 |
<>
|
83 |
<GsapAnimation
|
@@ -89,17 +91,6 @@ const Images = ({entry, index}) => {
|
|
89 |
Timeline={gsapTimeline}
|
90 |
>
|
91 |
<Audio src={staticFile('sfx_1.mp3')} />
|
92 |
-
<svg
|
93 |
-
xmlns="http://www.w3.org/2000/svg"
|
94 |
-
version="1.1"
|
95 |
-
className="filters"
|
96 |
-
>
|
97 |
-
<defs>
|
98 |
-
<filter id="blur">
|
99 |
-
<feGaussianBlur id="gaussianBlur" in="SourceGraphic" />
|
100 |
-
</filter>
|
101 |
-
</defs>
|
102 |
-
</svg>
|
103 |
<Img
|
104 |
id="imagex"
|
105 |
style={{
|
|
|
49 |
}
|
50 |
|
51 |
const Images = ({entry, index}) => {
|
52 |
+
const plugins = useMemo(() => [MotionPathPlugin], []);
|
53 |
+
|
54 |
+
const gsapTimeline = useMemo(() => {
|
55 |
let tlContainer = gsap.timeline();
|
56 |
// tlContainer.fromTo(
|
57 |
// '#gaussianBlur',
|
|
|
78 |
});
|
79 |
|
80 |
return tlContainer;
|
81 |
+
}, []);
|
82 |
+
|
83 |
return (
|
84 |
<>
|
85 |
<GsapAnimation
|
|
|
91 |
Timeline={gsapTimeline}
|
92 |
>
|
93 |
<Audio src={staticFile('sfx_1.mp3')} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
<Img
|
95 |
id="imagex"
|
96 |
style={{
|
Remotion-app/src/HelloWorld/TextStream.jsx
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import React, {
|
2 |
import {useVideoConfig, AbsoluteFill, TransitionSeries} from 'remotion';
|
3 |
import * as Fonts from '@remotion/google-fonts';
|
4 |
import transcriptData from './Assets/TextSequences.json';
|
@@ -33,6 +33,10 @@ Fonts.getAvailableFonts()
|
|
33 |
export const TextStream = () => {
|
34 |
const {fps} = useVideoConfig();
|
35 |
|
|
|
|
|
|
|
|
|
36 |
return (
|
37 |
<AbsoluteFill
|
38 |
style={{
|
@@ -44,7 +48,7 @@ export const TextStream = () => {
|
|
44 |
}}
|
45 |
>
|
46 |
<TransitionSeries>
|
47 |
-
{
|
48 |
const delta = entry.end - entry.start < 1 / 30 ? 0.2 : 0;
|
49 |
return (
|
50 |
<TransitionSeries.Sequence
|
|
|
1 |
+
import React, {useMemo} from 'react';
|
2 |
import {useVideoConfig, AbsoluteFill, TransitionSeries} from 'remotion';
|
3 |
import * as Fonts from '@remotion/google-fonts';
|
4 |
import transcriptData from './Assets/TextSequences.json';
|
|
|
33 |
export const TextStream = () => {
|
34 |
const {fps} = useVideoConfig();
|
35 |
|
36 |
+
const memoizedTranscriptData = useMemo(() => {
|
37 |
+
return transcriptData;
|
38 |
+
}, []);
|
39 |
+
|
40 |
return (
|
41 |
<AbsoluteFill
|
42 |
style={{
|
|
|
48 |
}}
|
49 |
>
|
50 |
<TransitionSeries>
|
51 |
+
{memoizedTranscriptData.map((entry, index) => {
|
52 |
const delta = entry.end - entry.start < 1 / 30 ? 0.2 : 0;
|
53 |
return (
|
54 |
<TransitionSeries.Sequence
|