Estilo Cartoon (Remotion), personagens reaproveitáveis e hashtags do TikTok

Estilo Cartoon (novo, sem Godot)
- Pacote cartoon/ (Remotion 4.0.535): cada trecho é um spec JSON desenhado
  em React/SVG e renderizado em MP4; render em lote (empacota uma vez) e
  imagem parada (--still).
- Cenas montadas por peças, sem cenário pronto: paletas (noite, sépia, dia,
  entardecer, cinza), lugar com chão, interno/externo, névoa e 24 peças
  posicionadas por profundidade, foco de luz e vinheta; etiquetas,
  onomatopeias, ondas de som, X vermelho, painel do topo e legenda palavra
  por palavra.
- Montagem documental: "Cartoon" como estilo do vídeo e tipo de visual do
  trecho; plano por regras pelo texto (lugar, objetos, expressão, pose),
  tempos das palavras pela transcrição do áudio, "Gerar de novo" por trecho,
  paleta da série e elenco da história.

Personagens
- Aba Personagens: criar pela descrição, ajustar peça por peça com prévia
  ao vivo, refinar com o agente (tarefa nova "Personagem"); fichas em
  assets/characters/ e elenco em stories/<id>/cast.json. O mesmo personagem
  sai igual em qualquer cena, mudando expressão, pose e objeto na mão.

TikTok
- Hashtags passam a ser digitadas e confirmadas na lista de sugestões do
  TikTok Studio (coladas, viravam texto). Diagnóstico de alcance em
  doc/publicacao/TIKTOK_DIAGNOSTICO.md.

Docs: estudo das referências, doc/cartoon/ (personagens e cenas) e skill
cenaforge 1.46.0.

Testes: painel 77/77, cartoon 5/5, Publicador 87/87.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 21:36:48 -03:00
co-authored by Claude Opus 5.5
parent e7ccc91736
commit 0050cf60a7
55 changed files with 5808 additions and 50 deletions
+132
View File
@@ -0,0 +1,132 @@
// Camadas por cima da cena: etiqueta, onomatopeia, contador, ondas de som, X vermelho, painel do topo (HUD) e a
// legenda palavra por palavra (cada palavra entra pequena e cresce; palavra-chave em amarelo, perigo em vermelho).
import React from "react";
import { spring } from "remotion";
import { COLORS, FONT_CAPTION, FONT_LABEL, TONE_BG, TONE_FG } from "./theme";
import type { ShotSpec, TextItem, Tone, Word } from "./spec";
/** 0 → 1 com mola, a partir de `startS` (antes disso, 0). */
export function pop(frame: number, fps: number, startS = 0, stiffness = 220): number {
const f = frame - Math.round(startS * fps);
return f < 0 ? 0 : spring({ frame: f, fps, config: { damping: 13, stiffness, mass: 0.6 } });
}
/** Tremor determinístico de ±amp px (vibração do gerador, onomatopeia). */
export function shake(frame: number, amp = 3): { x: number; y: number } {
return { x: Math.sin(frame * 12.9898) * amp, y: Math.cos(frame * 78.233) * amp * 0.7 };
}
const at = (x: number, y: number): React.CSSProperties => ({ position: "absolute", left: `${x * 100}%`, top: `${y * 100}%` });
export function TagLabel({ text, tone = "info", size = 3.6 }: { text: string; tone?: Tone; size?: number }) {
return (
<span style={{ fontFamily: FONT_LABEL, fontSize: `${size}cqw`, letterSpacing: "0.04em", lineHeight: 1, whiteSpace: "nowrap",
padding: "0.25em 0.5em 0.15em", borderRadius: "0.25em", background: TONE_BG[tone], color: TONE_FG[tone],
boxShadow: "0 0.15em 0 rgba(0,0,0,0.35)" }}>
{text.toUpperCase()}
</span>
);
}
export function TextLayer({ t, frame, fps }: { t: TextItem; frame: number; fps: number }) {
const k = pop(frame, fps, t.atS ?? 0);
if (k <= 0.001) return null;
const base = { ...at(t.x, t.y), transform: `translate(-50%, -50%) rotate(${t.rotate ?? 0}deg) scale(${0.4 + 0.6 * k})`, opacity: Math.min(1, k * 1.4) };
if (t.kind === "tag") return <div style={base}><TagLabel text={t.text} tone={t.tone} /></div>;
if (t.kind === "counter") {
return (
<div style={{ ...base, textAlign: "center", border: "0.35cqw solid #fff", borderRadius: "1.4cqw", padding: "0.8cqw 2.6cqw",
background: "rgba(10,12,28,0.85)" }}>
<div style={{ fontFamily: FONT_LABEL, fontSize: "2.6cqw", color: "#c9cbe0", letterSpacing: "0.08em" }}>{t.text.toUpperCase()}</div>
<div style={{ fontFamily: FONT_CAPTION, fontSize: "8cqw", color: "#fff", lineHeight: 1 }}>{t.value ?? ""}</div>
</div>
);
}
const s = t.kind === "onomatopoeia" ? shake(frame, 4) : { x: 0, y: 0 };
const color = t.tone === "danger" ? COLORS.danger : t.kind === "big" ? "#ffffff" : COLORS.key;
return (
<div style={{ ...base, transform: `${base.transform} translate(${s.x}px, ${s.y}px)`, fontFamily: FONT_CAPTION, color,
fontSize: t.kind === "big" ? "12cqw" : "9cqw", whiteSpace: "nowrap", WebkitTextStroke: "0.35cqw #121326",
paintOrder: "stroke fill", textShadow: "0 0.6cqw 0 rgba(0,0,0,0.35)" }}>
{t.text.toUpperCase()}
</div>
);
}
/** Anéis que crescem e somem em volta de (x, y) — barulho, luz chamando atenção. */
export function Rings({ frame, fps, color = COLORS.key }: { frame: number; fps: number; color?: string }) {
const period = fps * 1.3;
return (
<svg viewBox="-100 -100 200 200" width="100%" height="100%" overflow="visible" style={{ position: "absolute", inset: 0 }}>
{[0, 1, 2].map((i) => {
const p = ((frame + (i * period) / 3) % period) / period;
return <circle key={i} r={30 + p * 70} fill="none" stroke={color} strokeWidth={2.5} opacity={(1 - p) * 0.8} />;
})}
</svg>
);
}
/** X vermelho que se desenha por cima de algo ("não faça"). */
export function CrossOut({ k }: { k: number }) {
const len = 140 * Math.min(1, k);
return (
<svg viewBox="0 0 100 100" width="100%" height="100%" overflow="visible" style={{ position: "absolute", inset: 0 }}>
<line x1={0} y1={0} x2={len / 1.41} y2={len / 1.41} stroke={COLORS.danger} strokeWidth={9} strokeLinecap="round" />
{k > 0.5 && <line x1={100} y1={0} x2={100 - ((k - 0.5) * 2 * 140) / 1.41} y2={((k - 0.5) * 2 * 140) / 1.41} stroke={COLORS.danger} strokeWidth={9} strokeLinecap="round" />}
</svg>
);
}
export function Hud({ hud, frame, fps }: { hud: NonNullable<ShotSpec["hud"]>; frame: number; fps: number }) {
let clock = hud.clock;
if (clock && /^\d{1,2}:\d{2}$/.test(clock) && hud.clockMinutesPerSecond) {
const [h, m] = clock.split(":").map(Number);
const total = (h * 60 + m + Math.floor((frame / fps) * hud.clockMinutesPerSecond)) % (24 * 60);
clock = `${String(Math.floor(total / 60)).padStart(2, "0")}:${String(total % 60).padStart(2, "0")}`;
}
return (
<div style={{ position: "absolute", top: "5.5%", left: 0, right: 0, display: "flex", justifyContent: "center", alignItems: "center",
gap: "1.4cqw", fontFamily: FONT_LABEL }}>
<span style={{ background: COLORS.danger, color: "#fff", fontSize: "3.4cqw", padding: "0.2em 0.5em 0.1em", borderRadius: "0.25em" }}>⚡ {hud.badge.toUpperCase()}</span>
<span style={{ color: "#fff", fontSize: "4.2cqw" }}>{hud.label.toUpperCase()}</span>
{clock && <span style={{ background: "#0d0f1f", color: COLORS.key, fontSize: "3.4cqw", padding: "0.2em 0.45em 0.1em", borderRadius: "0.25em",
border: "0.25cqw solid #3a3f6b" }}>{clock}</span>}
</div>
);
}
/** Agrupa as palavras em blocos de até 3 (quebra também depois de pontuação), como a legenda da referência. */
export function captionChunks(words: Word[]): Word[][] {
const chunks: Word[][] = [];
let current: Word[] = [];
for (const w of words) {
current.push(w);
if (current.length >= 3 || /[.,!?;:…]$/.test(w.text)) { chunks.push(current); current = []; }
}
if (current.length) chunks.push(current);
return chunks;
}
export function Captions({ words, frame, fps, y = 0.665 }: { words: Word[]; frame: number; fps: number; y?: number }) {
const t = frame / fps;
const chunks = captionChunks(words);
const chunk = chunks.find((c, i) => t >= c[0].startS && (i === chunks.length - 1 || t < chunks[i + 1][0].startS));
if (!chunk) return null;
const last = chunk[chunk.length - 1];
if (t > last.endS + 0.6) return null;
return (
<div style={{ position: "absolute", left: "6%", right: "6%", top: `${y * 100}%`, transform: "translateY(-50%)", display: "flex",
flexWrap: "wrap", justifyContent: "center", alignItems: "baseline", columnGap: "2.2cqw", fontFamily: FONT_CAPTION, lineHeight: 1.05 }}>
{chunk.filter((w) => t >= w.startS).map((w, i) => {
const k = pop(frame, fps, w.startS, 320);
const color = w.tone === "danger" ? COLORS.danger : w.tone === "key" ? COLORS.key : "#ffffff";
return (
<span key={i} style={{ fontSize: "8.4cqw", color, transform: `scale(${0.55 + 0.45 * k})`, display: "inline-block",
textShadow: "0 0.5cqw 0 rgba(0,0,0,0.55), 0 0 1.4cqw rgba(0,0,0,0.5)" }}>
{w.text.toUpperCase().replace(/[.,;:]$/, "")}
</span>
);
})}
</div>
);
}