Skip to content

🎥 Make videos programmatically with React

reduce amount of skills

Jonny Burgerc0ce8891d2be
diff --git a/packages/skills/skills/remotion/rules/assets/3d-falling-spheres.tsx b/packages/skills/skills/remotion/rules/assets/3d-falling-spheres.tsx
deleted file mode 100644
index 4ef63d6f02..0000000000
--- a/packages/skills/skills/remotion/rules/assets/3d-falling-spheres.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import {AbsoluteFill, useCurrentFrame, useVideoConfig} from 'remotion';
-import {ThreeCanvas} from '@remotion/three';
-
-export const MyAnimation = () => {
- const frame = useCurrentFrame();
- const {width, height, fps} = useVideoConfig();
-
- const spheres = [
- {x: -1.5, z: -0.5, delay: 0, radius: 0.4, restitution: 0.75},
- {x: 0, z: 0, delay: 20, radius: 0.5, restitution: 0.75},
- {x: 1.5, z: 0.5, delay: 40, radius: 0.35, restitution: 0.75},
- {x: -0.8, z: 1, delay: 60, radius: 0.45, restitution: 0.75},
- {x: 0.8, z: -1, delay: 80, radius: 0.38, restitution: 0.75},
- ];
-
- const gravity = 12;
- const groundY = -2;
-
- const simulateBounce = (
- f: number,
- delay: number,
- radius: number,
- restitution: number,
- ) => {
- const elapsed = Math.max(0, f - delay);
- const t = elapsed / fps;
- const startY = 6;
- const surfaceY = groundY + radius;
-
- const firstImpactTime = Math.sqrt((2 * (startY - surfaceY)) / gravity);
-
- if (t <= firstImpactTime) {
- const y = startY - 0.5 * gravity * t * t;
- return {y, squash: 1};
- }
-
- let currentVelocity = gravity * firstImpactTime;
- let bounceStartTime = firstImpactTime;
-
- for (let bounce = 0; bounce < 20; bounce++) {
- currentVelocity *= restitution;
-
- if (currentVelocity < 0.5) {
- return {y: surfaceY, squash: 1};
- }
-
- const bounceDuration = (2 * currentVelocity) / gravity;
- const timeInBounce = t - bounceStartTime;
-
- if (timeInBounce <= bounceDuration) {
- const y =
- surfaceY +
- currentVelocity * timeInBounce -
- 0.5 * gravity * timeInBounce * timeInBounce;
- const impactProximity = Math.abs(y - surfaceY);
- const squash =
- impactProximity < 0.08
- ? 0.65 + (impactProximity / 0.08) * 0.35
- : 1;
- return {y: Math.max(surfaceY, y), squash};
- }
-
- bounceStartTime += bounceDuration;
- }
-
- return {y: surfaceY, squash: 1};
- };
-
- return (
- <AbsoluteFill style={{backgroundColor: '#000000'}}>
- <ThreeCanvas
- width={width}
- height={height}
- camera={{position: [0, 3, 8], fov: 40}}
- >
- <ambientLight intensity={0.05} />
-
- <mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, groundY, 0]}>
- <planeGeometry args={[20, 20]} />
- <meshStandardMaterial
- color="#0a0a0a"
- metalness={0.9}
- roughness={0.3}
- />
- </mesh>
-
- {spheres.map((sphere, i) => {
- const {y, squash} = simulateBounce(
- frame,
- sphere.delay,
- sphere.radius,
- sphere.restitution,
- );
- const stretch = 1 / squash;
-
- return (
- <group key={i} position={[sphere.x, y, sphere.z]}>
- <pointLight
- color="#ffd700"
- intensity={0.8}
- distance={4}
- decay={2}
- />
- <mesh scale={[1, squash, stretch]}>
- <sphereGeometry args={[sphere.radius, 32, 32]} />
- <meshStandardMaterial
- color="#ffd700"
- emissive="#cc7a00"
- emissiveIntensity={0.15}
- metalness={0.4}
- roughness={0.6}
- />
- </mesh>
- </group>
- );
- })}
- </ThreeCanvas>
- </AbsoluteFill>
- );
-};
diff --git a/packages/skills/skills/remotion/rules/assets/charts-animated-shapes.tsx b/packages/skills/skills/remotion/rules/assets/charts-animated-shapes.tsx
deleted file mode 100644
index 0f8cf7a7f3..0000000000
--- a/packages/skills/skills/remotion/rules/assets/charts-animated-shapes.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import {Circle, Rect, Star, Triangle} from '@remotion/shapes';
-import {
- AbsoluteFill,
- interpolate,
- spring,
- useCurrentFrame,
- useVideoConfig,
-} from 'remotion';
-
-export const COMPOSITION_HEIGHT = 400;
-export const COMPOSITION_WIDTH = 1080;
-
-export const MyAnimation = () => {
- const frame = useCurrentFrame();
- const {fps} = useVideoConfig();
-
- const shapes = [
- {type: 'circle', color: '#6366f1', delay: 0},
- {type: 'triangle', color: '#10b981', delay: 15},
- {type: 'rect', color: '#f59e0b', delay: 30},
- {type: 'star', color: '#ec4899', delay: 45},
- ];
-
- return (
- <AbsoluteFill
- style={{
- backgroundColor: '#0f0f0f',
- justifyContent: 'center',
- alignItems: 'center',
- }}
- >
- <div
- style={{
- display: 'flex',
- gap: 80,
- alignItems: 'center',
- }}
- >
- {shapes.map((shape, i) => {
- const entrance = spring({
- frame: frame - shape.delay,
- fps,
- config: {damping: 12, stiffness: 200},
- });
-
- const rotation = interpolate(frame, [0, 180], [0, 360], {
- extrapolateRight: 'clamp',
- });
-
- const bounce = Math.sin((frame - shape.delay) * 0.1) * 10;
-
- const scale = entrance;
- const opacity = entrance;
-
- const shapeProps = {
- fill: shape.color,
- stroke: '#fff',
- strokeWidth: 2,
- };
-
- return (
- <div
- key={i}
- style={{
- opacity,
- scale,
- translate: '0 ' + bounce + 'px',
- rotate: (shape.type === 'star' ? rotation : 0) + 'deg',
- }}
- >
- {shape.type === 'circle' && (
- <Circle radius={60} {...shapeProps} />
- )}
- {shape.type === 'triangle' && (
- <Triangle length={120} direction="up" {...shapeProps} />
- )}
- {shape.type === 'rect' && (
- <Rect
- width={100}
- height={100}
- cornerRadius={12}
- {...shapeProps}
- />
- )}
- {shape.type === 'star' && (
- <Star
- points={5}
- innerRadius={40}
- outerRadius={70}
- {...shapeProps}
- />
- )}
- </div>
- );
- })}
- </div>
- </AbsoluteFill>
- );
-};
diff --git a/packages/skills/skills/remotion/rules/assets/lottie-example.tsx b/packages/skills/skills/remotion/rules/assets/lottie-example.tsx
deleted file mode 100644
index ee64e3c35f..0000000000
--- a/packages/skills/skills/remotion/rules/assets/lottie-example.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import {Lottie, LottieAnimationData} from '@remotion/lottie';
-import {useEffect, useState} from 'react';
-import {cancelRender, continueRender, delayRender} from 'remotion';
-
-export const MyAnimation = () => {
- const [handle] = useState(() => delayRender('Loading Lottie animation'));
-
- const [animationData, setAnimationData] =
- useState<LottieAnimationData | null>(null);
-
- useEffect(() => {
- fetch('https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json')
- .then((data) => data.json())
- .then((json) => {
- setAnimationData(json);
- continueRender(handle);
- })
- .catch((err) => {
- cancelRender(err);
- });
- }, [handle]);
-
- if (!animationData) {
- return null;
- }
-
- return <Lottie animationData={animationData} />;
-};
diff --git a/packages/skills/skills/remotion/rules/charts.md b/packages/skills/skills/remotion/rules/charts.md
index 389d406348..cf1284901e 100644
--- a/packages/skills/skills/remotion/rules/charts.md
+++ b/packages/skills/skills/remotion/rules/charts.md
@@ -104,6 +104,4 @@ const offset = interpolate(progress, [0, 1], [segmentLength, 0]);
## Complete Examples
For full working code examples, see:
-- [Bar Chart Example](assets/bar-chart.tsx) - Bar chart with Y-axis labels and staggered springs
-- [Counter Animation Example](../example-counter/SKILL.md) - Animated number counters
-- [Animated Shapes Example](assets/animated-shapes.tsx) - Bouncing and rotating SVG shapes with spring animations
+- [Bar Chart Example](assets/charts/bar-chart.tsx) - Bar chart with Y-axis labels and staggered springs
diff --git a/packages/skills/skills/remotion/rules/lottie.md b/packages/skills/skills/remotion/rules/lottie.md
index c8096ebf40..4d07acded4 100644
--- a/packages/skills/skills/remotion/rules/lottie.md
+++ b/packages/skills/skills/remotion/rules/lottie.md
@@ -66,6 +66,3 @@ Lottie supports the `style` prop to allow styles and animations:
return <Lottie animationData={animationData} style={{width: 400, height: 400}} />;
```
-### Example
-
-See an example in [assets/example.tsx](assets/example.tsx).
diff --git a/packages/skills/skills/remotion/rules/text-animations.md b/packages/skills/skills/remotion/rules/text-animations.md
index 8122bae7ab..0b87b3f453 100644
--- a/packages/skills/skills/remotion/rules/text-animations.md
+++ b/packages/skills/skills/remotion/rules/text-animations.md
@@ -97,7 +97,7 @@ const finalOpacity = interpolate(frame, [highlightStart, highlightStart + 8], [0
For full working code examples, see:
-- [Typewriter](assets/typewriter.tsx) - Typewriter effect with blinking cursor and dramatic pause
-- [Word Highlight](assets/word-highlight.tsx) - Spring-animated highlight wipe on a word in a sentence
-- [Word Carousel](assets/word-carousel.tsx) - Rotating words with crossfade and blur
-- [Text Rotation](assets/text-rotation.tsx) - Rotating words with dissolve and blur effects
+- [Typewriter](assets/text-animations-typewriter.tsx) - Typewriter effect with blinking cursor and dramatic pause
+- [Word Highlight](assets/text-animations-word-highlight.tsx) - Spring-animated highlight wipe on a word in a sentence
+- [Word Carousel](assets/text-animations-word-carousel.tsx) - Rotating words with crossfade and blur
+- [Text Rotation](assets/text-animations-text-rotation.tsx) - Rotating words with dissolve and blur effects
diff --git a/packages/skills/src/Root.tsx b/packages/skills/src/Root.tsx
index 3e2c54bbf3..7d9cd8ccdb 100644
--- a/packages/skills/src/Root.tsx
+++ b/packages/skills/src/Root.tsx
@@ -1,5 +1,4 @@
import {Composition} from 'remotion';
-import {MyAnimation as FallingSpheresAnimation} from '../skills/remotion/3d/assets/falling-spheres';
import {
COMPOSITION_HEIGHT,
COMPOSITION_WIDTH,
@@ -39,14 +38,6 @@ export const RemotionRoot = () => {
width={1920}
height={1080}
/>
- <Composition
- id="FallingSpheres"
- component={FallingSpheresAnimation}
- durationInFrames={150}
- fps={30}
- width={1080}
- height={1080}
- />
<Composition
id="BarChart"
component={BarChartAnimation}