-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
198 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import {useInputChange} from '../src/components/hooks/onInputChange'; | ||
import {Player} from '@remotion/player'; | ||
import {Form, Input} from '../src/components/input'; | ||
import {Code} from '../src/components/Code'; | ||
import {Event} from "../src/event/Event"; | ||
|
||
const Home = () => { | ||
const [title, setTitle] = useInputChange<string>('Ap茅ro JS 馃嵕'); | ||
const [lottieAsset, setLottieAsset] = useInputChange<string | undefined>(undefined); | ||
const [paillettesAsset, setPaillettesAsset] = useInputChange<string | undefined>(undefined); | ||
const [backgroundImg, setBackgroundImg] = useInputChange<string | undefined>( | ||
undefined | ||
); | ||
const props = {title, lottieAsset, paillettesAsset, backgroundImg}; | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-col pb-4 justify-center items-center md:flex-row md:items-start"> | ||
<Player | ||
autoPlay | ||
controls | ||
loop | ||
className="shrink-0 shadow-lg" | ||
style={{ | ||
width: '400px', | ||
height: '400px', | ||
}} | ||
durationInFrames={180} | ||
compositionWidth={1200} | ||
compositionHeight={1200} | ||
fps={30} | ||
component={Event} | ||
inputProps={props} | ||
/> | ||
|
||
<Form> | ||
<Input setValue={setTitle} value={title} label="Title" /> | ||
<Input setValue={setLottieAsset} value={lottieAsset} label="LottieAsset (lf20_UDstUT)" /> | ||
<Input setValue={setPaillettesAsset} value={paillettesAsset} label="PaillettesAsset (lf20_tiviyc3p)" /> | ||
<Input | ||
setValue={setBackgroundImg} | ||
value={backgroundImg} | ||
label="Background image url" | ||
/> | ||
<a | ||
className="text-black py-2 px-4 text-center text-xl font-bold bg-yellow-300 rounded-xl mt-4 hover:scale-105" | ||
href="https://github.com/lyonjs/social-video-generator/actions/workflows/render-meetup.yml" | ||
target="_blank" | ||
> | ||
Generate your video 馃幀 | ||
</a> | ||
</Form> | ||
</div> | ||
|
||
<Code composition="Event" params={props} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Lottie} from '@remotion/lottie'; | ||
import {useLottie} from './hooks/useLottie'; | ||
import {AbsoluteFill} from 'remotion'; | ||
import {CSSProperties} from "react"; | ||
|
||
export const LottieAsset: React.FC<{assetLink? : string, style?: CSSProperties}> = ({assetLink, style}) => { | ||
const illustration = useLottie(assetLink); | ||
|
||
if (!illustration) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<AbsoluteFill style={{display: 'flex', alignItems: 'center'}}> | ||
<Lottie | ||
style={{ | ||
filter: 'drop-shadow(0px 0px 2px #000000)', | ||
color: 'white', | ||
fill: 'white', | ||
...style | ||
}} | ||
animationData={illustration} | ||
/> | ||
</AbsoluteFill> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {LottieAsset} from "./LottieAsset"; | ||
|
||
export const Paillettes: React.FC<{assetLink: string}> = ({assetLink}) => { | ||
return ( | ||
<LottieAsset assetLink={assetLink} style={{ | ||
position: 'absolute', | ||
bottom: 0, | ||
left: 0, | ||
width: '100%', | ||
}} /> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {AbsoluteFill, Sequence} from 'remotion'; | ||
import {ImageBackground} from '../components/ImageBackground'; | ||
import {LottieAsset} from "../components/LottieAsset"; | ||
import {EventTitle} from "./EventTitle"; | ||
import {Paillettes} from "../components/Paillettes"; | ||
|
||
export const Event: React.FC<{ | ||
backgroundImg?: string; | ||
title: string; | ||
lottieAsset?: string; | ||
paillettesAsset?: string; | ||
}> = ({ | ||
backgroundImg = 'https://i.pinimg.com/originals/de/0d/19/de0d19d835dd1224c5208701d78bd6e7.jpg', | ||
title, | ||
lottieAsset = 'lf20_UDstUT', | ||
paillettesAsset = 'lf20_tiviyc3p' | ||
}) => { | ||
|
||
return ( | ||
<AbsoluteFill> | ||
<ImageBackground animated src={backgroundImg}/> | ||
<Sequence from={50} durationInFrames={130} name='Paillette'> | ||
<Paillettes assetLink={paillettesAsset}/> | ||
</Sequence> | ||
|
||
<Sequence from={40} durationInFrames={140} name='Lottie Icon'> | ||
<LottieAsset assetLink={lottieAsset}/> | ||
</Sequence> | ||
|
||
<Sequence from={50} durationInFrames={130} name='Event title'> | ||
<EventTitle title={title}/> | ||
</Sequence> | ||
|
||
</AbsoluteFill> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {spring, useCurrentFrame, useVideoConfig} from 'remotion'; | ||
import {Title} from '../components/Title'; | ||
|
||
export const EventTitle: React.FC<{ | ||
title: string; | ||
}> = ({title}) => { | ||
const frame = useCurrentFrame(); | ||
const {fps, width} = useVideoConfig(); | ||
|
||
const fromBottom = spring({ | ||
frame, | ||
from: 0, | ||
to: 200, | ||
fps, | ||
durationInFrames: 30, | ||
}); | ||
|
||
return ( | ||
<Title | ||
style={{ | ||
color: 'white', | ||
position: 'absolute', | ||
bottom: fromBottom, | ||
fontSize: 100, | ||
width, | ||
textAlign: 'center', | ||
}} | ||
> | ||
{title} | ||
</Title> | ||
); | ||
}; |