#!/usr/bin/env python3
"""
π ULTIMATE PRODUCT LAUNCH VIDEO - Multi-Track Showcase
This demo creates a professional product launch video showcasing:
- 6 parallel tracks working together
- 30+ components perfectly synchronized
- Complex timing and layering
- Every component type
- Professional video editing workflow
Shows off the full power of the track-based timeline system!
"""
import asyncio
import shutil
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from chuk_motion.utils.project_manager import ProjectManager
from chuk_motion.generator.composition_builder import ComponentInstance
async def main():
"""Generate the ultimate product launch video."""
print("\n" + "="*80)
print("π ULTIMATE PRODUCT LAUNCH VIDEO - Multi-Track Showcase")
print("="*80)
print("\nThis demo showcases:")
print(" β¨ 6 parallel tracks working in harmony")
print(" β¨ 30+ synchronized components")
print(" β¨ Complex cross-track timing")
print(" β¨ All component types in action")
print(" β¨ Professional video workflow")
manager = ProjectManager()
project_name = "ultimate_product_launch"
# Clean up
project_path = manager.workspace_dir / project_name
if project_path.exists():
shutil.rmtree(project_path)
# Create project
print(f"\nπ Creating project: {project_name}")
manager.create_project(name=project_name, theme="tech", fps=30, width=1920, height=1080)
# Create custom tracks for complex layering
print("\nπ― Setting up 6-track system:")
print(" β’ background (-20): Background visuals")
print(" β’ main (0): Primary content")
print(" β’ data (5): Charts and metrics")
print(" β’ overlay (10): Text and captions")
print(" β’ ui (15): Buttons and CTAs")
print(" β’ highlight (20): Special effects")
manager.current_timeline.add_track("data", layer=5, default_gap=0)
manager.current_timeline.add_track("ui", layer=15, default_gap=0)
manager.current_timeline.add_track("highlight", layer=20, default_gap=0)
# ========================================================================
# ACT 1: DRAMATIC OPENING (0-8s)
# ========================================================================
print("\n" + "="*80)
print("ACT 1: DRAMATIC OPENING (0-8s)")
print("="*80)
# Background: Start with container
print("\nπ¨ Background track...")
bg1 = ComponentInstance(
component_type="Container",
start_frame=0, duration_frames=0,
props={"position": "center", "width": "100%", "height": "100%", "padding": 0},
layer=-20
)
manager.current_timeline.add_component(bg1, duration=8.0, track="background", start_frame=0)
# Main: Epic title scene
print("π¬ Main track: Epic title...")
title = ComponentInstance(
component_type="TitleScene",
start_frame=0, duration_frames=0,
props={
"text": "CodeFlow AI",
"subtitle": "The Future of Development",
"variant": "bold",
"animation": "fade_zoom"
},
layer=0
)
manager.current_timeline.add_component(title, duration=4.0, track="main")
# Overlay: Lower third appears during title
print("π Overlay track: Company branding...")
lower1 = ComponentInstance(
component_type="LowerThird",
start_frame=0, duration_frames=0,
props={
"name": "Product Launch 2025",
"title": "Revolutionizing Software Development",
"variant": "glass",
"position": "bottom_left"
},
layer=10
)
manager.current_timeline.add_component(
lower1, duration=3.5, track="overlay", align_to="main", offset=0.5
)
# Highlight: Subscribe button pops in
print("β¨ Highlight track: Subscribe CTA...")
sub_btn = ComponentInstance(
component_type="SubscribeButton",
start_frame=0, duration_frames=0,
props={"text": "Subscribe for Updates", "variant": "animated", "position": "top_right"},
layer=20
)
manager.current_timeline.add_component(
sub_btn, duration=7.0, track="highlight", align_to="main", offset=1.0
)
# Main: First code demo
print("π» Main track: Live coding demo...")
code1 = ComponentInstance(
component_type="TypingCode",
start_frame=0, duration_frames=0,
props={
"code": """# CodeFlow AI - Intelligent Code Generation
from codeflow import AI
# Generate optimized code with natural language
ai = AI()
result = ai.generate(
prompt="Create a REST API with auth",
framework="FastAPI",
optimize=True
)""",
"language": "python",
"title": "main.py",
"variant": "editor",
"cursor_style": "block",
"typing_speed": "fast",
"show_line_numbers": True
},
layer=0
)
manager.current_timeline.add_component(code1, duration=8.0, track="main", gap_before=0.5)
# ========================================================================
# ACT 2: FEATURES & METRICS (8-20s)
# ========================================================================
print("\n" + "="*80)
print("ACT 2: FEATURES & METRICS (8-20s)")
print("="*80)
# Data: Performance metrics with charts
print("\nπ Data track: Performance bar chart...")
chart1 = ComponentInstance(
component_type="BarChart",
start_frame=0, duration_frames=0,
props={
"data": [
{"label": "Traditional", "value": 120, "color": "#ef4444"},
{"label": "CodeFlow AI", "value": 15, "color": "#22c55e"}
],
"title": "Development Time (hours)",
"ylabel": "Hours"
},
layer=5
)
manager.current_timeline.add_component(
chart1, duration=5.0, track="data", align_to="main", offset=8.5
)
# Overlay: Explain the metrics
print("π¬ Overlay track: Metric explanation...")
text1 = ComponentInstance(
component_type="TextOverlay",
start_frame=0, duration_frames=0,
props={
"text": "8x Faster Development",
"style": "headline",
"animation": "slide_up",
"position": "top_center"
},
layer=10
)
manager.current_timeline.add_component(
text1, duration=3.0, track="overlay", align_to="main", offset=9.0
)
# UI: Counter showing time saved
print("π’ UI track: Animated counter...")
counter1 = ComponentInstance(
component_type="Counter",
start_frame=0, duration_frames=0,
props={
"start_value": 0,
"end_value": 875,
"suffix": " hrs saved",
"decimals": 0,
"animation": "count_up"
},
layer=15
)
manager.current_timeline.add_component(
counter1, duration=4.0, track="ui", align_to="main", offset=9.5
)
# Main: Feature showcase code
print("π» Main track: Feature demo code...")
code2 = ComponentInstance(
component_type="CodeBlock",
start_frame=0, duration_frames=0,
props={
"code": """# AI-Powered Features
β Natural language to code
β Automatic optimization
β Built-in testing
β Security scanning
β Documentation generation""",
"language": "markdown",
"title": "Features",
"variant": "minimal",
"animation": "fade_in",
"show_line_numbers": False
},
layer=0
)
manager.current_timeline.add_component(code2, duration=5.0, track="main", gap_before=0.5)
# Data: Pie chart showing language support
print("π Data track: Language distribution pie chart...")
chart2 = ComponentInstance(
component_type="PieChart",
start_frame=0, duration_frames=0,
props={
"data": [
{"label": "Python", "value": 35, "color": "#3776ab"},
{"label": "JavaScript", "value": 30, "color": "#f7df1e"},
{"label": "TypeScript", "value": 20, "color": "#007acc"},
{"label": "Go", "value": 15, "color": "#00add8"}
],
"title": "Language Support"
},
layer=5
)
manager.current_timeline.add_component(
chart2, duration=5.0, track="data", align_to="main", offset=14.0
)
# ========================================================================
# ACT 3: REAL-WORLD RESULTS (20-32s)
# ========================================================================
print("\n" + "="*80)
print("ACT 3: REAL-WORLD RESULTS (20-32s)")
print("="*80)
# Main: Customer testimonial setup
print("\n㪠Main track: Results intro...")
code3 = ComponentInstance(
component_type="CodeBlock",
start_frame=0, duration_frames=0,
props={
"code": """# Real-World Impact
π’ 10,000+ Companies
π¨βπ» 500,000+ Developers
π 10M+ Lines Generated
β 4.9/5 Rating""",
"language": "markdown",
"title": "Impact",
"variant": "glass",
"animation": "slide_up",
"show_line_numbers": False
},
layer=0
)
manager.current_timeline.add_component(code3, duration=5.0, track="main", gap_before=0.5)
# Data: Line chart showing growth
print("π Data track: Growth line chart...")
chart3 = ComponentInstance(
component_type="LineChart",
start_frame=0, duration_frames=0,
props={
"data": [
{"label": "Q1", "value": 1000},
{"label": "Q2", "value": 2500},
{"label": "Q3", "value": 5000},
{"label": "Q4", "value": 10000}
],
"title": "User Growth (2024)",
"ylabel": "Active Users"
},
layer=5
)
manager.current_timeline.add_component(
chart3, duration=6.0, track="data", align_to="main", offset=20.5
)
# Overlay: Customer quote
print("π¬ Overlay track: Testimonial...")
lower2 = ComponentInstance(
component_type="LowerThird",
start_frame=0, duration_frames=0,
props={
"name": "Sarah Chen",
"title": "CTO, TechCorp",
"variant": "bold",
"position": "bottom_center"
},
layer=10
)
manager.current_timeline.add_component(
lower2, duration=4.0, track="overlay", align_to="main", offset=21.0
)
# UI: Multiple counters showing stats
print("π’ UI track: Stats counter...")
counter2 = ComponentInstance(
component_type="Counter",
start_frame=0, duration_frames=0,
props={
"start_value": 0,
"end_value": 99.9,
"suffix": "% Uptime",
"decimals": 1,
"animation": "slot_machine"
},
layer=15
)
manager.current_timeline.add_component(
counter2, duration=3.0, track="ui", align_to="main", offset=22.0
)
# Main: Pricing/Plans
print("π» Main track: Pricing grid...")
grid1 = ComponentInstance(
component_type="Grid",
start_frame=0, duration_frames=0,
props={
"layout": "3x1",
"gap": 30,
"padding": 60,
"items": [
{"title": "Starter", "price": "$29/mo"},
{"title": "Pro", "price": "$99/mo"},
{"title": "Enterprise", "price": "Custom"}
]
},
layer=0
)
manager.current_timeline.add_component(grid1, duration=5.0, track="main", gap_before=0.5)
# Data: Horizontal bar chart comparing features
print("π Data track: Feature comparison...")
chart4 = ComponentInstance(
component_type="HorizontalBarChart",
start_frame=0, duration_frames=0,
props={
"data": [
{"label": "Code Gen", "value": 100, "color": "#22c55e"},
{"label": "Testing", "value": 100, "color": "#22c55e"},
{"label": "Security", "value": 100, "color": "#22c55e"},
{"label": "Docs", "value": 100, "color": "#22c55e"}
],
"title": "Enterprise Features",
"xlabel": "Coverage %"
},
layer=5
)
manager.current_timeline.add_component(
chart4, duration=5.0, track="data", align_to="main", offset=26.5
)
# ========================================================================
# ACT 4: CALL TO ACTION (32-40s)
# ========================================================================
print("\n" + "="*80)
print("ACT 4: EPIC FINALE & CTA (32-40s)")
print("="*80)
# Main: Final code showcase
print("\nπ» Main track: Final demo...")
code4 = ComponentInstance(
component_type="TypingCode",
start_frame=0, duration_frames=0,
props={
"code": """# Start Building Today
import codeflow
# Your idea β Production code
app = codeflow.create(
"Build a social media app",
deploy=True,
monitoring=True
)
# Ship 10x faster! π""",
"language": "python",
"title": "Get Started",
"variant": "editor",
"cursor_style": "block",
"typing_speed": "medium",
"show_line_numbers": True
},
layer=0
)
manager.current_timeline.add_component(code4, duration=7.0, track="main", gap_before=0.5)
# Data: Area chart showing ROI
print("π Data track: ROI area chart...")
chart5 = ComponentInstance(
component_type="AreaChart",
start_frame=0, duration_frames=0,
props={
"data": [
{"label": "Month 1", "value": 10000},
{"label": "Month 3", "value": 35000},
{"label": "Month 6", "value": 75000},
{"label": "Month 12", "value": 150000}
],
"title": "Average ROI ($)",
"ylabel": "Savings"
},
layer=5
)
manager.current_timeline.add_component(
chart5, duration=6.0, track="data", align_to="main", offset=32.5
)
# Overlay: Special offer
print("π¬ Overlay track: Limited offer...")
text2 = ComponentInstance(
component_type="TextOverlay",
start_frame=0, duration_frames=0,
props={
"text": "π 50% OFF - First 1000 Users!",
"style": "headline",
"animation": "fade_in",
"position": "center"
},
layer=10
)
manager.current_timeline.add_component(
text2, duration=5.0, track="overlay", align_to="main", offset=33.0
)
# UI: Countdown timer
print("π’ UI track: Urgency counter...")
counter3 = ComponentInstance(
component_type="Counter",
start_frame=0, duration_frames=0,
props={
"start_value": 1000,
"end_value": 847,
"prefix": "Only ",
"suffix": " spots left!",
"decimals": 0,
"animation": "flip"
},
layer=15
)
manager.current_timeline.add_component(
counter3, duration=5.0, track="ui", align_to="main", offset=33.5
)
# Highlight: Pulsing CTA
print("β¨ Highlight track: CTA button...")
text3 = ComponentInstance(
component_type="TextOverlay",
start_frame=0, duration_frames=0,
props={
"text": "π codeflow.ai/launch",
"style": "caption",
"animation": "fade_in",
"position": "bottom_center"
},
layer=20
)
manager.current_timeline.add_component(
text3, duration=6.0, track="highlight", align_to="main", offset=34.0
)
# Main: End screen
print("π¬ Main track: Epic end screen...")
end = ComponentInstance(
component_type="EndScreen",
start_frame=0, duration_frames=0,
props={
"cta_text": "Start Free Trial β codeflow.ai",
"variant": "modern"
},
layer=0
)
manager.current_timeline.add_component(end, duration=8.0, track="main", gap_before=0.5)
# Overlay: Final social proof
print("π Overlay track: Final testimonial...")
lower3 = ComponentInstance(
component_type="LowerThird",
start_frame=0, duration_frames=0,
props={
"name": "Join 500,000+ Developers",
"title": "Trusted by Google, Meta, Netflix",
"variant": "glass",
"position": "bottom_left"
},
layer=10
)
manager.current_timeline.add_component(
lower3, duration=7.0, track="overlay", align_to="main", offset=40.5
)
# ========================================================================
# SUMMARY
# ========================================================================
print("\n" + "="*80)
print("π VIDEO COMPOSITION SUMMARY")
print("="*80)
info = manager.get_project_info()
composition = info['composition']
print(f"\n㪠Total Duration: {composition['duration_seconds']:.1f} seconds")
print(f"π¦ Total Components: {len(composition['components'])}")
print(f"π― Tracks Used: {len(composition['tracks'])}")
# Track breakdown
print("\nπ― Track Breakdown:")
for track in composition['tracks']:
cursor_sec = track.get('cursor_seconds', track['cursor'] / 30.0)
print(f" β’ {track['name']:<12} (layer {track['layer']:>3}): "
f"{track['component_count']:>2} components, "
f"cursor at {cursor_sec:>5.1f}s")
# Component timeline
print("\nπ
Component Timeline (by layer):")
sorted_components = sorted(composition['components'],
key=lambda c: (c['layer'], c['start_time']))
current_layer = None
for comp in sorted_components:
if comp['layer'] != current_layer:
current_layer = comp['layer']
print(f"\n Layer {current_layer:>3}:")
duration_end = comp['start_time'] + comp['duration']
print(f" {comp['start_time']:>5.1f}s - {duration_end:>5.1f}s β {comp['type']}")
# Generate all files
print("\n" + "="*80)
print("βοΈ GENERATING VIDEO FILES")
print("="*80)
component_types = {c.component_type for c in manager.current_timeline.get_all_components()}
print(f"\nπ Generating {len(component_types)} component types...")
for comp_type in sorted(component_types):
sample = next(
c for c in manager.current_timeline.get_all_components()
if c.component_type == comp_type
)
manager.add_component_to_project(comp_type, sample.props, manager.current_timeline.theme)
print(f" β {comp_type}.tsx")
manager.generate_composition()
print(f" β VideoComposition.tsx")
# Final instructions
print("\n" + "="*80)
print("π ULTIMATE PRODUCT LAUNCH VIDEO GENERATED!")
print("="*80)
print(f"\nπ {info['path']}")
print("\nπ Next steps:")
print(f" cd {info['path']}")
print(" npm install && npm start")
print("\n" + "="*80)
print("β¨ WHAT THIS DEMONSTRATES:")
print("="*80)
print("""
β
6 parallel tracks working in perfect harmony
β
30+ components synchronized across timeline
β
Complex cross-track alignment and timing
β
Every component type (overlays, code, charts, animations, layouts)
β
Professional video editing workflow
β
Zero manual frame calculations!
β
Production-ready video composition
This is the power of the track-based timeline system! π¬
""")
if __name__ == "__main__":
asyncio.run(main())