// Um trecho do estilo Cartoon: cena de fundo + personagens + objetos + textos + HUD + legenda, com a câmera // fazendo um empurrão lento (nunca fica parado, como na referência). import React from "react"; import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion"; import { CrowdFigure, PersonFigure } from "./actors"; import { Icon } from "./icons"; import { Captions, CrossOut, Grain, Hud, Rings, TagLabel, TextLayer, pop, shake } from "./overlays"; import { SceneBackground } from "./scenes"; import { CharacterFigure } from "./CharacterFigure"; import { evaluate } from "./motion"; import { LightLayer } from "./places"; import type { ShotSpec } from "./spec"; import { loadFonts } from "./theme"; loadFonts(); export function Shot(spec: ShotSpec) { const frame = useCurrentFrame(); const { fps, durationInFrames, width, height } = useVideoConfig(); const progress = durationInFrames > 1 ? frame / (durationInFrames - 1) : 0; const push = spec.camera?.push ?? (spec.scene.kind === "card" ? 1 : 1.07); const zoom = 1 + (push - 1) * progress; return ( {(spec.actors ?? []).map((a, i) => { const k = pop(frame, fps, a.enterS ?? 0); if (a.kind === "crowd") { return (
); } if (a.character) { // Personagem da biblioteca: mesmo visual em toda cena. Expressão, pose, andar, pular, falar… saem da // linha do tempo (motion.ts), com a boca na fala (palavras + volume do áudio). const t = frame / fps; const st = evaluate({ x: a.x, expression: a.expression, pose: a.pose, face: a.face, body: a.body, flip: a.flip, timeline: a.timeline }, t, spec.durationS, spec.seed + i * 13, { words: spec.words ?? [], env: spec.audioEnv }); // Meio corpo / de perto: o personagem cresce e os pés saem do quadro (cabeça perto do terço de cima). const zoom = a.framing === "close" ? 2.9 : a.framing === "medium" ? 1.9 : 1; const ch = height * 0.36 * (a.scale ?? 1) * zoom; const cw = (ch * 200) / 440; const baseY = a.framing === "close" ? 1.15 : a.framing === "medium" ? 0.98 : a.y; const label = a.label ?? a.character.name; const showLabel = label && Math.abs(st.rot) < 30; return (
{showLabel && (
1 ? "8%" : "50%", top: zoom > 1 ? "22%" : "-15%", transform: `translateX(-50%) scaleX(${st.flip ? -1 : 1})`, textAlign: "center" }}> {a.character.caption &&
}
)}
); } const h = height * 0.27 * (a.scale ?? 1); return (
{a.label &&
}
); })} {(spec.props ?? []).map((p, i) => { const k = pop(frame, fps, p.enterS ?? 0); if (k <= 0.001) return null; const size = height * (p.size ?? 0.16); const s = p.shake ? shake(frame, 2.5) : { x: 0, y: 0 }; const cross = p.crossed ? pop(frame, fps, (p.enterS ?? 0) + 0.5, 90) : 0; return (
{p.rings &&
} {p.crossed &&
} {p.label &&
}
); })} {(spec.texts ?? []).map((t, i) => )}
{(spec.grain ?? 0.11) > 0 && } {spec.hud && } {spec.words?.length ? : null}
); }