Skip to content

🎥 Make videos programmatically with React

add an emoji card

Jonny Burgereda33ed63edc
diff --git a/packages/animated-emoji/src/AnimatedEmoji.tsx b/packages/animated-emoji/src/AnimatedEmoji.tsx
index 908b9a3d4f..ac67309fdf 100644
--- a/packages/animated-emoji/src/AnimatedEmoji.tsx
+++ b/packages/animated-emoji/src/AnimatedEmoji.tsx
@@ -1,4 +1,4 @@
-import type {RemotionOffthreadVideoProps} from 'remotion';
+import type {LayoutAndStyle, RemotionOffthreadVideoProps} from 'remotion';
import {Loop, OffthreadVideo, useVideoConfig} from 'remotion';
import type {CalculateEmojiSrc, Scale} from './calculate-emoji-src';
import {defaultCalculateEmojiSrc} from './calculate-emoji-src';
@@ -10,7 +10,7 @@ export type AnimatedEmojiProps = Omit<RemotionOffthreadVideoProps, 'src'> & {
readonly emoji: EmojiName;
readonly scale?: Scale;
readonly calculateSrc?: CalculateEmojiSrc;
-};
+} & LayoutAndStyle;
export const AnimatedEmoji = ({
emoji,
@@ -28,7 +28,10 @@ export const AnimatedEmoji = ({
}
return (
- <Loop durationInFrames={Math.floor(emojiData.durationInSeconds * fps)}>
+ <Loop
+ layout="none"
+ durationInFrames={Math.floor(emojiData.durationInSeconds * fps)}
+ >
<OffthreadVideo
{...props}
src={calculateSrc({emoji, scale, format: isWebkit() ? 'hevc' : 'webm'})}
diff --git a/packages/docs/src/remotion/HomepageVideo/Card.tsx b/packages/docs/src/remotion/HomepageVideo/Card.tsx
index 0e65411fb7..8ff137d51d 100644
--- a/packages/docs/src/remotion/HomepageVideo/Card.tsx
+++ b/packages/docs/src/remotion/HomepageVideo/Card.tsx
@@ -8,6 +8,7 @@ import React, {
import {AbsoluteFill, spring} from 'remotion';
import type {Trending} from './Comp';
import {CurrentCountry} from './CurrentCountry';
+import {EmojiCard} from './EmojiCard';
import {Temperature} from './Temperature';
import {TrendingRepos} from './TrendingRepos';
import styles from './player-styles.module.css';
@@ -356,7 +357,7 @@ export const Cards: React.FC<{
) : index === 2 ? (
<CurrentCountry location={location} theme={theme} />
) : (
- '🐹'
+ <EmojiCard />
);
return (
<Card
diff --git a/packages/docs/src/remotion/HomepageVideo/Comp.tsx b/packages/docs/src/remotion/HomepageVideo/Comp.tsx
index 076626cef3..c70ace1751 100644
--- a/packages/docs/src/remotion/HomepageVideo/Comp.tsx
+++ b/packages/docs/src/remotion/HomepageVideo/Comp.tsx
@@ -22,13 +22,16 @@ export const getDataAndProps = async () => {
const trending = await fetch(
'https://bugs.remotion.dev/trending?lat=' +
- location.lat +
+ location.latitude +
'&lng=' +
- location.lng,
+ location.longitude,
)
.then((res) => res.json())
.then((data) => {
- return {repos: data.repos.slice(0, 3), date: data.dateFetched};
+ return {
+ repos: data.trending.repos.slice(0, 3),
+ date: data.trending.dateFetched,
+ };
});
return {trending, location};
diff --git a/packages/docs/src/remotion/HomepageVideo/types.ts b/packages/docs/src/remotion/HomepageVideo/types.ts
index 71e632b6b8..072082a2cc 100644
--- a/packages/docs/src/remotion/HomepageVideo/types.ts
+++ b/packages/docs/src/remotion/HomepageVideo/types.ts
@@ -1,4 +1,6 @@
export type Location = {
country: string;
city: string;
+ latitude: number;
+ longitude: number;
};
diff --git a/packages/docs/src/remotion/Root.tsx b/packages/docs/src/remotion/Root.tsx
index a4c15f3552..f8dcca51eb 100644
--- a/packages/docs/src/remotion/Root.tsx
+++ b/packages/docs/src/remotion/Root.tsx
@@ -82,6 +82,8 @@ export const RemotionRoot: React.FC = () => {
location: {
country: 'US',
city: 'New York',
+ latitude: 40.7128,
+ longitude: -74.006,
},
trending: null,
onToggle: () => undefined,
diff --git a/packages/docs/static/partying-face-0.5x.mp4 b/packages/docs/static/partying-face-0.5x.mp4
new file mode 100644
index 0000000000..3cf97a8bcf
Binary files /dev/null and b/packages/docs/static/partying-face-0.5x.mp4 differ
diff --git a/packages/docs/static/partying-face-0.5x.webm b/packages/docs/static/partying-face-0.5x.webm
new file mode 100644
index 0000000000..813deb2456
Binary files /dev/null and b/packages/docs/static/partying-face-0.5x.webm differ
diff --git a/packages/docs/static/partying-face-1x.mp4 b/packages/docs/static/partying-face-1x.mp4
new file mode 100644
index 0000000000..70ff4504a6
Binary files /dev/null and b/packages/docs/static/partying-face-1x.mp4 differ
diff --git a/packages/docs/static/partying-face-1x.webm b/packages/docs/static/partying-face-1x.webm
new file mode 100644
index 0000000000..ec0fbd1ee5
Binary files /dev/null and b/packages/docs/static/partying-face-1x.webm differ
diff --git a/packages/docs/static/partying-face-2x.mp4 b/packages/docs/static/partying-face-2x.mp4
new file mode 100644
index 0000000000..a3c9c5d854
Binary files /dev/null and b/packages/docs/static/partying-face-2x.mp4 differ
diff --git a/packages/docs/static/partying-face-2x.webm b/packages/docs/static/partying-face-2x.webm
new file mode 100644
index 0000000000..ccfa08e3c8
Binary files /dev/null and b/packages/docs/static/partying-face-2x.webm differ