Cartoon: rig, movimento e lip sync dos personagens
- cartoon/src/rig.ts, motion.ts e lipsync.ts: esqueleto do personagem, curvas de movimento e sincronia labial no estilo Cartoon (Remotion) - CharacterFigure/CharacterCard/Shot/overlays e spec atualizados - Painel: estúdio de personagens e montagem cartoon ajustados - Documentação em doc/cartoon/animacao.md e personagens.md; skill atualizada Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-8
@@ -4,9 +4,10 @@ import React from "react";
|
||||
import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";
|
||||
import { CrowdFigure, PersonFigure } from "./actors";
|
||||
import { Icon } from "./icons";
|
||||
import { Captions, CrossOut, Hud, Rings, TagLabel, TextLayer, pop, shake } from "./overlays";
|
||||
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";
|
||||
@@ -35,16 +36,25 @@ export function Shot(spec: ShotSpec) {
|
||||
);
|
||||
}
|
||||
if (a.character) {
|
||||
// Personagem da biblioteca: mesmo visual em toda cena; muda expressão, pose e objeto na mão.
|
||||
const ch = height * 0.36 * (a.scale ?? 1);
|
||||
// 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 (
|
||||
<div key={i} style={{ position: "absolute", left: a.x * width - cw / 2, top: a.y * height - ch, width: cw, height: ch,
|
||||
opacity: Math.min(1, k * 1.5), transform: `translateY(${(1 - k) * 10}%) scaleX(${a.flip ? -1 : 1})` }}>
|
||||
<CharacterFigure look={a.character.look} expression={a.expression} pose={a.pose} item={a.item} t={frame / fps} />
|
||||
{label && (
|
||||
<div style={{ position: "absolute", left: "50%", top: "-15%", transform: `translateX(-50%) scaleX(${a.flip ? -1 : 1})`, textAlign: "center" }}>
|
||||
<div key={i} style={{ position: "absolute", left: (st.x + st.dx) * width - cw / 2, top: (baseY + st.dy) * height - ch, width: cw, height: ch,
|
||||
opacity: Math.min(1, k * 1.5), transformOrigin: "50% 100%",
|
||||
transform: `translateY(${(1 - k) * 10}%) rotate(${st.rot}deg) scale(${(st.flip ? -1 : 1) * st.sx}, ${st.sy})` }}>
|
||||
<CharacterFigure look={a.character.look} item={a.item} t={t} state={st} />
|
||||
{showLabel && (
|
||||
<div style={{ position: "absolute", left: zoom > 1 ? "8%" : "50%", top: zoom > 1 ? "22%" : "-15%", transform: `translateX(-50%) scaleX(${st.flip ? -1 : 1})`, textAlign: "center" }}>
|
||||
<TagLabel text={label} />
|
||||
{a.character.caption && <div style={{ marginTop: "0.6cqw" }}><TagLabel text={a.character.caption} tone="ok" size={2.4} /></div>}
|
||||
</div>
|
||||
@@ -80,6 +90,7 @@ export function Shot(spec: ShotSpec) {
|
||||
<LightLayer light={spec.light} palette={spec.palette} />
|
||||
{(spec.texts ?? []).map((t, i) => <TextLayer key={i} t={t} frame={frame} fps={fps} />)}
|
||||
</AbsoluteFill>
|
||||
{(spec.grain ?? 0.11) > 0 && <Grain opacity={spec.grain ?? 0.11} seed={spec.seed} />}
|
||||
{spec.hud && <Hud hud={spec.hud} frame={frame} fps={fps} />}
|
||||
{spec.words?.length ? <Captions words={spec.words} frame={frame} fps={fps} /> : null}
|
||||
</AbsoluteFill>
|
||||
|
||||
Reference in New Issue
Block a user