Spaces:
Sleeping
Sleeping
File size: 1,156 Bytes
323961b |
1 2 3 4 5 6 7 8 9 10 11 12 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 |
import React, { CSSProperties } from 'react';
import { TransitionImplementationProps } from 'remotion-transition-series/lib/components/Transition';
export const FadeThroughColor: React.FC<
TransitionImplementationProps & { color: CSSProperties['backgroundColor'] }
> = ({
color = 'black',
progress,
exitingElement = null,
enteringElement = null,
}) => {
return (
<>
<div
style={{
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
}}
>
{exitingElement}
</div>
<div
style={{
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
backgroundColor: color,
opacity: Math.min(1, progress * 2),
}}
/>
<div
style={{
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
opacity: Math.max(0, 2 * progress - 1),
}}
>
{enteringElement}
</div>
</>
);
};
|