Skip to content

🎥 Make videos programmatically with React

Tune prompt and minor AnimationPlayer UI fixes

ASchwadfa15c9db0137
diff --git a/packages/template-code-generation/src/app/api/generate/route.ts b/packages/template-code-generation/src/app/api/generate/route.ts
index 28e3db753f..8b2cb0fb1e 100644
--- a/packages/template-code-generation/src/app/api/generate/route.ts
+++ b/packages/template-code-generation/src/app/api/generate/route.ts
@@ -138,7 +138,7 @@ const highlightProgress = spring({fps, frame: f - highlightStart, config: {dampi
const highlightScaleX = Math.max(0, Math.min(1, highlightProgress));
return (
- <AbsoluteFill style={{display: "flex", alignItems: "center", justifyContent: "center", transform: \`scale(\${containerScale})\`}}>
+ <AbsoluteFill style={{display: "flex", alignItems: "center", justifyContent: "center"}}>
<div style={{position: "relative"}}>
{/* Typing layer */}
<div style={{color: COLOR_TEXT, fontSize: FONT_SIZE, fontWeight: FONT_WEIGHT, lineHeight: 1.15, whiteSpace: "pre-wrap", opacity: typedOpacity}}>
@@ -506,15 +506,20 @@ return (
END OF EXAMPLES
IMPORTANT RULES:
-1. Start the code with a multi-line comment (/* */) containing a 2-3 sentence description of what you're building
-2. NEVER include imports or exports - they are provided automatically
-3. Available APIs: React, AbsoluteFill, interpolate, useCurrentFrame, useVideoConfig, spring, Sequence
-4. Use creative animations with smooth transitions
-5. Component should use frame-based animations with interpolate()
-6. Make it visually impressive and modern
-7. Use inline styles for all styling
-8. ALWAYS use fontFamily: 'Inter, sans-serif' for ALL text elements to ensure consistent rendering
-9. Do not define the component name - start directly with the comment, then the code
+- Start the code with a multi-line comment (/* */) containing a 2-3 sentence description of what you're building
+- NEVER include imports or exports - they are provided automatically
+- Available APIs: React, AbsoluteFill, interpolate, useCurrentFrame, useVideoConfig, spring, Sequence
+- Use creative animations with smooth transitions
+- Component should use frame-based animations with interpolate()
+- Make it visually impressive and modern
+- Use inline styles for all styling
+- ALWAYS use fontFamily: 'Inter, sans-serif' for ALL text elements to ensure consistent rendering
+- Do not define the component name - start directly with the comment, then the code
+- Do not generate typescript types or interfaces
+- ALWAYS make sure to show all contents on the screen WITHOUT going off-screen or being cut off
+- ALWAYS set backgroundColor on AbsoluteFill from frame 0 - never fade in backgrounds
+- NEVER NEVER NEVER use fade-in for the AbsoluteFill container - always have it fully visible from frame 0
+
`;
export async function POST(req: Request) {
diff --git a/packages/template-code-generation/src/components/AnimationPlayer.tsx b/packages/template-code-generation/src/components/AnimationPlayer.tsx
index 064695e06e..689051def3 100644
--- a/packages/template-code-generation/src/components/AnimationPlayer.tsx
+++ b/packages/template-code-generation/src/components/AnimationPlayer.tsx
@@ -37,7 +37,9 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({
return (
<div className="flex flex-3 flex-col items-center bg-[#0a0a0a] min-w-0">
<div className="w-full max-w-[1200px]">
- <h2 className="text-sm font-medium text-[#888] mb-3">Video Preview</h2>
+ <h2 className="text-sm font-medium text-[#888] mb-3">
+ Video Preview
+ </h2>
<div className="w-full aspect-video flex justify-center items-center bg-[#1a1a1a] rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]">
<div className="w-12 h-12 border-4 border-[#333] border-t-[#6366f1] rounded-full animate-spin" />
</div>
@@ -50,7 +52,9 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({
return (
<div className="flex flex-3 flex-col items-center bg-[#0a0a0a] min-w-0">
<div className="w-full max-w-[1200px]">
- <h2 className="text-sm font-medium text-[#888] mb-3">Video Preview</h2>
+ <h2 className="text-sm font-medium text-[#888] mb-3">
+ Video Preview
+ </h2>
<div className="w-full aspect-video flex justify-center items-center bg-[#2a1a1a] rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)] border border-[#dc2626]">
<div className="text-center max-w-[80%]">
<div className="text-[#dc2626] text-base font-semibold mb-2 font-sans">
@@ -70,7 +74,9 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({
return (
<div className="flex flex-3 flex-col items-center bg-[#0a0a0a] min-w-0">
<div className="w-full max-w-[1200px]">
- <h2 className="text-sm font-medium text-[#888] mb-3">Video Preview</h2>
+ <h2 className="text-sm font-medium text-[#888] mb-3">
+ Video Preview
+ </h2>
<div className="w-full aspect-video flex justify-center items-center bg-[#1a1a1a] rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)] text-[#666] text-lg font-sans">
Select an example to get started
</div>
@@ -94,7 +100,7 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({
style={{
width: "100%",
height: "100%",
- backgroundColor: "white",
+ backgroundColor: "transparent",
}}
controls
autoPlay