- Mãos com formas e rotações próprias, membros articulados (limbs) e animais. - Elementos de cenário separados (natureza, construções, interiores) e testes de lugares. - Personagens reaproveitáveis de Noé e a Arca (Noé, esposa, Sem, Cam e Jafé) e a fonte Barlow Semi Condensed. - História noe-e-a-arca: pauta, bíblia, roteiro do ep. 1, tomadas Cartoon e montagem. - Montagem: narração mais corrida (tira silêncios longos) e cabeçalho com o número do vídeo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 lines
6.1 KiB
TypeScript
97 lines
6.1 KiB
TypeScript
// Personagens "de recorte": peças rígidas (cabeça, cabelo, tronco, braços, pernas) que se mexem por inteiro —
|
||
// sem boca sincronizada, como na referência. Multidão = silhuetas.
|
||
import React from "react";
|
||
import { COLORS } from "./colors";
|
||
import { rng } from "./random";
|
||
import type { Crowd, Person } from "./spec";
|
||
import type { CharacterLook } from "./character";
|
||
import { CharacterFigure } from "./CharacterFigure";
|
||
import { evaluate } from "./motion";
|
||
|
||
/** Pessoa em pé num viewBox 200×420; (0,0) do grupo = pés no centro. */
|
||
export function PersonFigure({ p, frame, fps }: { p: Person; frame: number; fps: number }) {
|
||
const skin = p.skin ?? "#c98a5e";
|
||
const outfit = p.outfit ?? "#9b7be0";
|
||
const hair = p.hairColor ?? "#e8e8ee";
|
||
const sway = Math.sin(frame / (fps * 0.9)) * 1.5;
|
||
const arm = p.pointing ? -70 + Math.sin(frame / (fps * 0.5)) * 4 : 6 + Math.sin(frame / fps) * 2;
|
||
return (
|
||
<svg viewBox="0 0 200 420" width="100%" height="100%" overflow="visible">
|
||
<g transform={`rotate(${sway} 100 420)`}>
|
||
<rect x={74} y={300} width={18} height={115} rx={6} fill={COLORS.ink} />
|
||
<rect x={108} y={300} width={18} height={115} rx={6} fill={COLORS.ink} />
|
||
<path d="M60 150 Q100 130 140 150 L156 320 Q100 334 44 320 Z" fill={outfit} />
|
||
{[0, 1, 2, 3, 4, 5].map((i) => <circle key={i} cx={70 + (i % 3) * 30} cy={190 + Math.floor(i / 3) * 70} r={4} fill="#ffffff" opacity={0.55} />)}
|
||
<g transform={`rotate(${arm} 142 160)`}>
|
||
<rect x={136} y={156} width={16} height={110} rx={8} fill={outfit} />
|
||
<circle cx={144} cy={270} r={10} fill={skin} />
|
||
</g>
|
||
<g transform={`rotate(${-6 - Math.sin(frame / fps) * 2} 58 160)`}>
|
||
<rect x={48} y={156} width={16} height={110} rx={8} fill={outfit} />
|
||
<circle cx={56} cy={270} r={10} fill={skin} />
|
||
</g>
|
||
<rect x={90} y={118} width={20} height={26} fill={skin} />
|
||
<circle cx={100} cy={92} r={40} fill={skin} />
|
||
{p.hair === "bun" && <><circle cx={100} cy={46} r={20} fill={hair} /><path d="M60 88 Q100 40 140 88 Q140 64 100 56 Q60 64 60 88" fill={hair} /></>}
|
||
{(p.hair ?? "short") === "short" && <path d="M58 90 Q60 46 100 48 Q142 46 142 90 Q132 64 100 64 Q70 64 58 90" fill={hair} />}
|
||
{p.glasses && (
|
||
<g fill="none" stroke={COLORS.ink} strokeWidth={4}>
|
||
<circle cx={84} cy={92} r={11} /><circle cx={116} cy={92} r={11} /><line x1={95} y1={92} x2={105} y2={92} />
|
||
</g>
|
||
)}
|
||
<circle cx={84} cy={93} r={4} fill={COLORS.ink} />
|
||
<circle cx={116} cy={93} r={4} fill={COLORS.ink} />
|
||
<path d="M88 112 Q100 118 112 112" stroke={COLORS.ink} strokeWidth={4} fill="none" strokeLinecap="round" />
|
||
</g>
|
||
</svg>
|
||
);
|
||
}
|
||
|
||
const SKINS = ["#f1c7a3", "#e0b48f", "#d09a70", "#c08055", "#a8704a", "#8d5a3b", "#6e4630"];
|
||
const HAIRS = ["#2a1e16", "#3a2a1e", "#6b4226", "#c9c9cf", "#e8c35a", "#1e1612", "#8a8a92"];
|
||
const CLOTHES = ["#3f6b8a", "#c8443a", "#5b6b3a", "#e8b13a", "#7a5ce0", "#2f6db3", "#d98a5c", "#4f7a4a", "#8a6f9e", "#56704a", "#e9ecef"];
|
||
const pick = <T,>(r: () => number, list: readonly T[]): T => list[Math.floor(r() * list.length) % list.length];
|
||
|
||
/** Aparência sorteada de quem está na multidão: cada um diferente (cabeça, altura, cabelo, roupa, acessório). */
|
||
export function crowdLook(seed: number): CharacterLook {
|
||
const r = rng(seed * 7919 + 17);
|
||
const female = r() < 0.45;
|
||
const old = r() < 0.25;
|
||
const hairStyle = female ? pick(r, ["long", "bun", "curly", "side"] as const) : pick(r, ["short", "side", "bald", "curly", "spiky", "cap"] as const);
|
||
const top = pick(r, female ? (["shirt", "dress", "hoodie", "jacket"] as const) : (["shirt", "jacket", "hoodie", "uniform", "shirt"] as const));
|
||
const acc: NonNullable<CharacterLook["accessories"]> = [];
|
||
const roll = r();
|
||
if (!female && roll < 0.14) { acc.push("helmet", "vest"); } else if (roll < 0.22) acc.push("scarf"); else if (roll < 0.3) acc.push("watch");
|
||
return {
|
||
build: pick(r, ["slim", "average", "average", "heavy"] as const), height: 0.86 + r() * 0.26, skin: pick(r, SKINS),
|
||
hair: { style: hairStyle, color: old ? "#c9c9cf" : pick(r, HAIRS) },
|
||
beard: { style: female ? "none" : pick(r, ["none", "none", "stubble", "mustache", "full", "goatee"] as const), color: old ? "#b0b0b8" : pick(r, HAIRS) },
|
||
glasses: r() < 0.22 ? pick(r, ["round", "square"] as const) : "none", brows: r() < 0.5 ? "thick" : "thin",
|
||
top: { style: top, color: pick(r, CLOTHES), accent: pick(r, CLOTHES) }, bottom: { style: female && r() < 0.3 ? "skirt" : "pants", color: pick(r, ["#2c3346", "#3a3f4a", "#5a4a3a", "#2b3a5a"]) },
|
||
shoes: pick(r, ["#1d1d24", "#5a3a22", "#f2f2f2"]), head: pick(r, ["round", "oval", "square", "wide"] as const), nose: pick(r, ["curve", "round", "button", "wide", "long"] as const),
|
||
lids: 0.1 + r() * 0.35, wrinkles: old ? 0.6 : 0, belly: !female && r() < 0.2, ...(acc.length ? { accessories: acc, accessoryColor: acc[0] === "helmet" ? "#f2a31a" : undefined } : {}),
|
||
};
|
||
}
|
||
|
||
/** Multidão: pessoas desenhadas com o mesmo traço dos personagens, cada uma diferente, em duas fileiras. */
|
||
export function CrowdFigure({ c, frame, fps = 30 }: { c: Crowd; frame: number; fps?: number }) {
|
||
const rand = rng(c.count * 31 + 3);
|
||
const people = Array.from({ length: c.count }, (_, i) => ({ i, x: (i + 0.5) / c.count + (rand() - 0.5) * 0.04, back: i % 2 === 1, p: rand() * 6 }))
|
||
.sort((a, b) => Number(b.back) - Number(a.back));
|
||
const t = frame / fps;
|
||
return (
|
||
<div style={{ position: "absolute", inset: 0 }}>
|
||
{people.map((m) => {
|
||
const h = m.back ? 78 : 92;
|
||
const st = evaluate({ x: 0, expression: pick(rng(m.i + 5), ["neutral", "smile", "happy", "neutral", "smirk", "surprised"] as const) }, t, 3600, m.i * 7 + 3);
|
||
return (
|
||
<div key={m.i} style={{ position: "absolute", left: `${m.x * 100 - h * 0.11}%`, bottom: `${(m.back ? 8 : 0) + Math.sin(t * 2 + m.p) * 0.4}%`, height: `${h}%`, aspectRatio: "200 / 440",
|
||
filter: m.back ? "brightness(0.82)" : undefined }}>
|
||
<CharacterFigure look={crowdLook(m.i + c.count * 13)} t={t} state={st} shadeSide={1} />
|
||
</div>
|
||
);
|
||
})}
|
||
</div>
|
||
);
|
||
}
|