All files / src/components CinematicDemo.tsx

21.05% Statements 4/19
0% Branches 0/9
0% Functions 0/4
21.05% Lines 4/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277                                    1x                                                                             1x                                                                                                                                                                                                                                                                                                                                             1x                                                     1x                                                  
import React from "react";
import {
  AbsoluteFill,
  Sequence,
  useCurrentFrame,
  useVideoConfig,
  Audio,
  staticFile,
} from "remotion";
import { z } from "zod";
import { HookScene } from "./scenes/HookScene";
import { ProblemScene } from "./scenes/ProblemScene";
import { ManimScene, ManimPlaceholder } from "./scenes/ManimScene";
import { TerminalScene } from "./scenes/TerminalScene";
import { ResultsScene } from "./scenes/ResultsScene";
import { CTAScene } from "./scenes/CTAScene";
import { SceneTransition } from "./shared/TransitionWipe";
 
export const cinematicDemoSchema = z.object({
  skillName: z.string(),
  hook: z.string(),
  problemPoints: z.array(z.string()).default([
    "Manual processes slow you down",
    "Context switching kills productivity",
    "No unified workflow",
  ]),
  terminalVideo: z.string(),
  manimVideo: z.string().optional(),
  manimType: z.enum(["agent-spawning", "task-dependency", "workflow"]).optional(),
  results: z.object({
    before: z.string(),
    after: z.string(),
    stats: z.array(
      z.object({
        label: z.string(),
        value: z.union([z.string(), z.number()]),
        suffix: z.string().optional(),
      })
    ).default([]),
  }),
  primaryColor: z.string().default("#8b5cf6"),
  ccVersion: z.string().default("CC 2.1.16"),
  // Scene durations in frames
  hookDuration: z.number().default(60),
  problemDuration: z.number().default(90),
  manimDuration: z.number().default(120),
  terminalDuration: z.number().default(300),
  resultsDuration: z.number().default(90),
  ctaDuration: z.number().default(60),
  // Audio options
  backgroundMusic: z.string().optional(),
  musicVolume: z.number().default(0.12),
  enableSoundEffects: z.boolean().default(true),
});
 
type CinematicDemoProps = z.infer<typeof cinematicDemoSchema>;
 
export const CinematicDemo: React.FC<CinematicDemoProps> = ({
  skillName,
  hook,
  problemPoints,
  terminalVideo,
  manimVideo,
  manimType = "agent-spawning",
  results,
  primaryColor,
  ccVersion,
  hookDuration,
  problemDuration,
  manimDuration,
  terminalDuration,
  resultsDuration,
  ctaDuration,
  backgroundMusic,
  musicVolume,
  enableSoundEffects,
}) => {
  const { durationInFrames, fps } = useVideoConfig();
  const frame = useCurrentFrame();
 
  // Calculate scene start frames
  const hookStart = 0;
  const problemStart = hookDuration;
  const manimStart = problemStart + problemDuration;
  const terminalStart = manimStart + manimDuration;
  const resultsStart = terminalStart + terminalDuration;
  const ctaStart = resultsStart + resultsDuration;
 
  // Transition frames (8 frames each)
  const transitionDuration = 8;
 
  return (
    <AbsoluteFill style={{ backgroundColor: "#0a0a0f" }}>
      {/* Background Music */}
      {backgroundMusic && (
        <Audio
          src={staticFile(backgroundMusic)}
          volume={(f) => {
            // Fade in at start, fade out at end
            const fadeIn = Math.min(1, f / (fps * 0.5));
            const fadeOut = Math.min(1, (durationInFrames - f) / (fps * 1));
            return fadeIn * fadeOut * musicVolume;
          }}
        />
      )}
 
      {/* Scene 1: Hook */}
      <Sequence from={hookStart} durationInFrames={hookDuration}>
        <HookScene
          skillName={skillName}
          hook={hook}
          ccVersion={ccVersion}
          primaryColor={primaryColor}
        />
      </Sequence>
 
      {/* Transition 1 */}
      <SceneTransition
        type="fade"
        startFrame={hookStart + hookDuration - transitionDuration}
        durationFrames={transitionDuration}
      />
 
      {/* Scene 2: Problem */}
      <Sequence from={problemStart} durationInFrames={problemDuration}>
        <ProblemScene
          problems={problemPoints}
          primaryColor="#ef4444"
          title="Before OrchestKit"
        />
      </Sequence>
 
      {/* Transition 2 */}
      <SceneTransition
        type="fade"
        startFrame={problemStart + problemDuration - transitionDuration}
        durationFrames={transitionDuration}
      />
 
      {/* Scene 3: Manim Animation */}
      <Sequence from={manimStart} durationInFrames={manimDuration}>
        {manimVideo ? (
          <ManimScene
            videoPath={manimVideo}
            title="Agent Orchestration"
            subtitle="CC 2.1.16 Task Management"
          />
        ) : (
          <ManimPlaceholder
            type={manimType}
            primaryColor={primaryColor}
            agentCount={6}
          />
        )}
      </Sequence>
 
      {/* Transition 3 */}
      <SceneTransition
        type="fade"
        startFrame={manimStart + manimDuration - transitionDuration}
        durationFrames={transitionDuration}
      />
 
      {/* Scene 4: Terminal Demo */}
      <Sequence from={terminalStart} durationInFrames={terminalDuration}>
        <TerminalScene
          videoPath={terminalVideo}
          showHeader={true}
          headerText={`/${skillName} in action`}
          primaryColor={primaryColor}
        />
      </Sequence>
 
      {/* Transition 4 */}
      <SceneTransition
        type="fade"
        startFrame={terminalStart + terminalDuration - transitionDuration}
        durationFrames={transitionDuration}
      />
 
      {/* Scene 5: Results */}
      <Sequence from={resultsStart} durationInFrames={resultsDuration}>
        <ResultsScene
          before={results.before}
          after={results.after}
          stats={results.stats}
          primaryColor="#22c55e"
        />
      </Sequence>
 
      {/* Transition 5 */}
      <SceneTransition
        type="fade"
        startFrame={resultsStart + resultsDuration - transitionDuration}
        durationFrames={transitionDuration}
      />
 
      {/* Scene 6: CTA */}
      <Sequence from={ctaStart} durationInFrames={ctaDuration}>
        <CTAScene
          installCommand="/plugin install ork"
          primaryColor={primaryColor}
          stats={{ skills: 169, agents: 35 }}
          ccVersion={ccVersion}
        />
      </Sequence>
 
      {/* Success sound effect on CTA */}
      {enableSoundEffects && frame >= ctaStart && frame < ctaStart + 2 && (
        <Audio src={staticFile("audio/success.mp3")} volume={0.3} />
      )}
 
      {/* Watermark */}
      <Watermark />
 
      {/* Progress bar */}
      <ProgressBar
        progress={frame / durationInFrames}
        primaryColor={primaryColor}
      />
    </AbsoluteFill>
  );
};
 
const Watermark: React.FC = () => {
  return (
    <div
      style={{
        position: "absolute",
        top: 20,
        right: 24,
        display: "flex",
        alignItems: "center",
        gap: 8,
        opacity: 0.6,
      }}
    >
      <span
        style={{
          fontSize: 14,
          color: "#6b7280",
          fontFamily: "Menlo, monospace",
          fontWeight: 500,
        }}
      >
        OrchestKit
      </span>
    </div>
  );
};
 
const ProgressBar: React.FC<{ progress: number; primaryColor: string }> = ({
  progress,
  primaryColor,
}) => {
  return (
    <div
      style={{
        position: "absolute",
        bottom: 0,
        left: 0,
        right: 0,
        height: 3,
        backgroundColor: "rgba(255,255,255,0.1)",
      }}
    >
      <div
        style={{
          height: "100%",
          width: `${progress * 100}%`,
          background: `linear-gradient(90deg, ${primaryColor}, #6366f1)`,
        }}
      />
    </div>
  );
};