File size: 591 Bytes
e2c597b
 
 
0cf5523
 
7191cf4
 
 
 
 
0cf5523
7191cf4
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {useGsapTimeline} from '../../lib/useGsapTimeline';
import {AbsoluteFill} from 'remotion';
import React, {useMemo} from 'react';
import gsap from 'gsap';

const GsapAnimation = React.memo(
	({Timeline, style, className, children, plugins = []}) => {
		const memoizedPlugins = useMemo(() => {
			return [...plugins];
		}, [plugins]);

		gsap.registerPlugin(memoizedPlugins);
		const ContainerRef = useGsapTimeline(Timeline);
		return (
			<AbsoluteFill className={className} style={style} ref={ContainerRef}>
				{children}
			</AbsoluteFill>
		);
	}
);

export default GsapAnimation;