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:
@@ -0,0 +1,162 @@
|
||||
// Fundos do estilo Cartoon, desenhados num espaço fixo de 1080×1920 (o SVG escala para o tamanho do vídeo).
|
||||
import React from "react";
|
||||
import { COLORS, FONT_CAPTION, FONT_LABEL, SKY } from "./theme";
|
||||
import { rng } from "./random";
|
||||
import { PlaceBackground } from "./places";
|
||||
import type { ShotSpec, TimeOfDay } from "./spec";
|
||||
|
||||
export const W = 1080;
|
||||
export const H = 1920;
|
||||
|
||||
type SceneProps = { spec: ShotSpec; frame: number; progress: number };
|
||||
|
||||
function Sky({ time, seed, frame }: { time: TimeOfDay; seed: number; frame: number }) {
|
||||
const [top, bottom] = SKY[time];
|
||||
const rand = rng(seed + 7);
|
||||
const stars = time === "day" ? [] : Array.from({ length: 70 }, () => ({ x: rand() * W, y: rand() * H * 0.45, r: 1 + rand() * 2.2, p: rand() * 6 }));
|
||||
return (
|
||||
<>
|
||||
<defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stopColor={top} />
|
||||
<stop offset="1" stopColor={bottom} />
|
||||
</linearGradient>
|
||||
<radialGradient id="glow">
|
||||
<stop offset="0" stopColor="rgba(255,200,80,0.55)" />
|
||||
<stop offset="1" stopColor="rgba(255,200,80,0)" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<rect width={W} height={H} fill="url(#sky)" />
|
||||
{stars.map((s, i) => (
|
||||
<circle key={i} cx={s.x} cy={s.y} r={s.r} fill="#fff" opacity={0.35 + 0.35 * Math.sin(frame / 12 + s.p)} />
|
||||
))}
|
||||
{time === "night" && <circle cx={W * 0.2} cy={H * 0.11} r={38} fill="#f4ecc8" />}
|
||||
{time === "dawn" && <circle cx={W * 0.8} cy={H * 0.2} r={46} fill="#ffd36b" />}
|
||||
{time === "day" && <circle cx={W * 0.82} cy={H * 0.1} r={56} fill="#ffe27a" />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** Casa chapada: corpo, telhado, janelas (acesas ou não) e porta. */
|
||||
export function HouseShape({ x, base, w, h, color, lit, detail = true }: {
|
||||
x: number; base: number; w: number; h: number; color: string; lit?: boolean; detail?: boolean;
|
||||
}) {
|
||||
const roofH = h * 0.42;
|
||||
const win = w * 0.18;
|
||||
const winY = base - h * 0.62;
|
||||
const windowFill = lit ? COLORS.light : COLORS.window;
|
||||
return (
|
||||
<g>
|
||||
{lit && <ellipse cx={x + w / 2} cy={base - h * 0.5} rx={w * 1.4} ry={h * 1.3} fill="url(#glow)" />}
|
||||
<polygon points={`${x - w * 0.06},${base - h} ${x + w / 2},${base - h - roofH} ${x + w * 1.06},${base - h}`} fill={COLORS.roof} />
|
||||
<rect x={x} y={base - h} width={w} height={h} fill={color} />
|
||||
{detail && (
|
||||
<>
|
||||
<rect x={x + w * 0.14} y={winY} width={win} height={win * 1.1} rx={3} fill={windowFill} />
|
||||
<rect x={x + w * 0.68} y={winY} width={win} height={win * 1.1} rx={3} fill={windowFill} />
|
||||
<rect x={x + w * 0.42} y={base - h * 0.48} width={w * 0.16} height={h * 0.48} fill={COLORS.window} />
|
||||
</>
|
||||
)}
|
||||
</g>
|
||||
);
|
||||
}
|
||||
|
||||
function Street({ spec, frame, progress }: SceneProps) {
|
||||
const time = spec.scene.time ?? "night";
|
||||
const pan = (spec.camera?.panX ?? 0) * W * progress;
|
||||
const rand = rng(spec.seed);
|
||||
const rows = [
|
||||
{ base: H * 0.43, w: 92, h: 70, gap: 6, color: COLORS.houseFar, depth: 0.25, detail: false },
|
||||
{ base: H * 0.5, w: 150, h: 110, gap: 14, color: COLORS.house[2], depth: 0.5, detail: true },
|
||||
{ base: H * 0.6, w: 250, h: 180, gap: 30, color: COLORS.house[0], depth: 1, detail: true },
|
||||
];
|
||||
return (
|
||||
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="100%" preserveAspectRatio="xMidYMid slice">
|
||||
<Sky time={time} seed={spec.seed} frame={frame} />
|
||||
{rows.map((row, r) => {
|
||||
const count = Math.ceil((W * 1.6) / (row.w + row.gap)) + 2;
|
||||
const start = -W * 0.3 - pan * row.depth;
|
||||
const litIndex = spec.scene.litHouse && r === 2 ? Math.floor(count / 2) - 1 : -1;
|
||||
return (
|
||||
<g key={r}>
|
||||
<rect x={0} y={row.base} width={W} height={H * 0.6 - row.base + 2} fill={r === 2 ? COLORS.ground : "transparent"} />
|
||||
{Array.from({ length: count }, (_, i) => {
|
||||
const jitter = (rand() - 0.5) * row.h * 0.18;
|
||||
return (
|
||||
<HouseShape key={i} x={start + i * (row.w + row.gap)} base={row.base} w={row.w} h={row.h + jitter}
|
||||
color={row.color} lit={i === litIndex} detail={row.detail} />
|
||||
);
|
||||
})}
|
||||
</g>
|
||||
);
|
||||
})}
|
||||
<rect x={0} y={H * 0.6} width={W} height={H * 0.4} fill={COLORS.road} />
|
||||
{Array.from({ length: 9 }, (_, i) => (
|
||||
<rect key={i} x={((i * 160 - pan * 1.2) % (W + 160)) - 80} y={H * 0.735} width={90} height={8} rx={4} fill={COLORS.roadLine} />
|
||||
))}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function HouseFront({ spec, frame }: SceneProps) {
|
||||
const time = spec.scene.time ?? "night";
|
||||
const lit = !!spec.scene.litHouse;
|
||||
return (
|
||||
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="100%" preserveAspectRatio="xMidYMid slice">
|
||||
<Sky time={time} seed={spec.seed} frame={frame} />
|
||||
<polygon points={`-40,${H * 0.3} ${W / 2},${H * 0.17} ${W + 40},${H * 0.3}`} fill={COLORS.roof} />
|
||||
<rect x={0} y={H * 0.3} width={W} height={H * 0.32} fill={COLORS.house[3]} />
|
||||
<rect x={W * 0.08} y={H * 0.36} width={W * 0.2} height={H * 0.08} rx={6} fill={lit ? COLORS.light : COLORS.window} />
|
||||
<rect x={W * 0.72} y={H * 0.36} width={W * 0.2} height={H * 0.08} rx={6} fill={lit ? COLORS.light : COLORS.window} />
|
||||
<rect x={0} y={H * 0.53} width={W} height={H * 0.09} fill={COLORS.house[1]} />
|
||||
{Array.from({ length: 13 }, (_, i) => (
|
||||
<rect key={i} x={W * 0.34 + i * 26} y={H * 0.53} width={7} height={H * 0.09} fill={COLORS.ink} />
|
||||
))}
|
||||
<rect x={W * 0.33} y={H * 0.53} width={W * 0.34} height={10} fill={COLORS.ink} />
|
||||
<rect x={0} y={H * 0.62} width={W} height={H * 0.38} fill={COLORS.road} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function Plain({ spec, frame }: SceneProps) {
|
||||
const time = spec.scene.time ?? "night";
|
||||
return (
|
||||
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="100%" preserveAspectRatio="xMidYMid slice">
|
||||
<Sky time={time} seed={spec.seed} frame={frame} />
|
||||
<rect x={0} y={H * 0.6} width={W} height={H * 0.4} fill={COLORS.road} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function Blueprint() {
|
||||
return (
|
||||
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="100%" preserveAspectRatio="xMidYMid slice">
|
||||
<rect width={W} height={H} fill={COLORS.blueprint} />
|
||||
{Array.from({ length: 28 }, (_, i) => <rect key={`v${i}`} x={i * 40} y={0} width={1.5} height={H} fill={COLORS.grid} />)}
|
||||
{Array.from({ length: 49 }, (_, i) => <rect key={`h${i}`} x={0} y={i * 40} width={W} height={1.5} fill={COLORS.grid} />)}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function Card({ spec }: SceneProps) {
|
||||
const card = spec.card!;
|
||||
return (
|
||||
<div style={{ position: "absolute", inset: 0, background: "#07080f", display: "flex", flexDirection: "column",
|
||||
alignItems: "center", justifyContent: "center", gap: "1.2%", textAlign: "center", padding: "0 8%" }}>
|
||||
<div style={{ fontFamily: FONT_CAPTION, fontSize: "11cqw", color: COLORS.text, lineHeight: 1 }}>{card.title}</div>
|
||||
{card.subtitle && <div style={{ fontFamily: FONT_LABEL, fontSize: "6cqw", color: COLORS.key }}>{card.subtitle}</div>}
|
||||
{card.footer && <div style={{ fontFamily: FONT_LABEL, fontSize: "3.2cqw", color: "#b7b9cc", marginTop: "6%" }}>{card.footer}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SceneBackground(props: SceneProps) {
|
||||
switch (props.spec.scene.kind) {
|
||||
case "place": return <PlaceBackground spec={props.spec} frame={props.frame} />;
|
||||
case "street": return <Street {...props} />;
|
||||
case "house": return <HouseFront {...props} />;
|
||||
case "blueprint": return <Blueprint />;
|
||||
case "card": return <Card {...props} />;
|
||||
default: return <Plain {...props} />;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user