Files
CenaForge/cartoon/src/animals.tsx
T
MateuusandClaude Opus 5.5 2d8b1a582d Cartoon: mãos, membros e cenários novos; elenco de Noé e a Arca
- 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>
2026-11-18 01:51:11 -03:00

158 lines
9.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Animais do estilo Cartoon: figuras reaproveitáveis em qualquer história (não são cena pronta). Cada espécie
// é desenhada por formas chapadas no mesmo traço dos personagens, olhando para a direita, com as patas em
// (100, 200) num viewBox 200×200. Andar mexe as patas; ave voando bate as asas. Cor e escala vêm do spec.
import React from "react";
export const SPECIES = ["dove", "raven", "elephant", "giraffe", "lion", "sheep", "horse", "camel"] as const;
export type Species = (typeof SPECIES)[number];
/** Altura de referência de cada espécie (fração da altura do quadro, com scale 1). */
export const SPECIES_HEIGHT: Record<Species, number> = {
dove: 0.05, raven: 0.055, elephant: 0.2, giraffe: 0.3, lion: 0.12, sheep: 0.085, horse: 0.17, camel: 0.19,
};
/** Aves podem voar (asas batendo, sem patas no chão). */
export const BIRDS: readonly Species[] = ["dove", "raven"];
const INK = "#15161f";
const DEFAULT_COLOR: Record<Species, string> = {
dove: "#f4f4f8", raven: "#23242e", elephant: "#9aa0ab", giraffe: "#e8b54a", lion: "#d99a3a", sheep: "#f1ece0", horse: "#8a5a3a", camel: "#c9a06a",
};
function shade(hex: string, k: number): string {
const n = parseInt(hex.slice(1), 16);
const c = (v: number) => Math.max(0, Math.min(255, Math.round(v * k))).toString(16).padStart(2, "0");
return `#${c((n >> 16) & 255)}${c((n >> 8) & 255)}${c(n & 255)}`;
}
/** Perna que balança pelo quadril: `phase` vem do passo (0 parado). */
function Leg({ x, y, len, w, fill, swing }: { x: number; y: number; len: number; w: number; fill: string; swing: number }) {
return <rect x={x - w / 2} y={y} width={w} height={len} rx={w / 2.4} fill={fill} transform={`rotate(${swing} ${x} ${y})`} />;
}
function Eye({ x, y, r = 4.5, light }: { x: number; y: number; r?: number; light?: boolean }) {
return <g><circle cx={x} cy={y} r={r} fill={light ? "#ffffff" : INK} />{light ? <circle cx={x + 1} cy={y} r={r * 0.55} fill={INK} /> : <circle cx={x + 1.3} cy={y - 1.3} r={r * 0.3} fill="#ffffff" />}</g>;
}
/** Ramo de oliveira no bico (pomba da história do dilúvio, mas serve para qualquer ave). */
function Branch({ x, y }: { x: number; y: number }) {
return (
<g transform={`translate(${x} ${y})`}>
<path d="M0 0 Q14 6 30 4" stroke="#6b4a2a" strokeWidth={2.4} fill="none" strokeLinecap="round" />
{[[8, 2, -30], [16, 6, 30], [22, 2, -30], [28, 6, 25]].map(([lx, ly, r], i) => <ellipse key={i} cx={lx} cy={ly} rx={6} ry={2.6} fill={i % 2 ? "#7fa24a" : "#5f8a3a"} transform={`rotate(${r} ${lx} ${ly})`} />)}
</g>
);
}
export function AnimalFigure({ species, color, t = 0, walking = false, flying = false, carry, seed = 0 }: {
species: Species; color?: string; t?: number; walking?: boolean; flying?: boolean; carry?: "olive"; seed?: number;
}) {
const c = color ?? DEFAULT_COLOR[species];
const dark = shade(c, 0.78);
// Passo: pernas da frente e de trás em oposição; corpo sobe e desce de leve.
const ph = walking ? Math.sin((t + seed * 0.37) * Math.PI * 2 * 1.6) : 0;
const bob = walking ? Math.abs(ph) * -3 : Math.sin(t * 2 + seed) * 0.8;
const flap = flying ? Math.sin((t + seed * 0.21) * Math.PI * 2 * 3.2) : 0;
const body = (inner: React.ReactNode) => <svg viewBox="0 0 200 200" width="100%" height="100%" overflow="visible"><g transform={`translate(0 ${bob})`}>{inner}</g></svg>;
switch (species) {
case "dove": case "raven": {
const beak = species === "dove" ? "#e8a04a" : "#3a3b46";
if (flying) {
return body(<g>
<path d={`M78 112 Q60 ${100 - flap * 50} 30 ${96 - flap * 70} Q66 ${112 - flap * 20} 84 124 Z`} fill={dark} />
<ellipse cx={100} cy={122} rx={36} ry={18} fill={c} />
<path d="M66 120 L40 112 L44 132 Z" fill={dark} />
<circle cx={134} cy={112} r={15} fill={c} />
<path d="M147 110 L162 114 L147 118 Z" fill={beak} />
<Eye x={138} y={109} r={3.2} />
<path d={`M104 116 Q118 ${100 - flap * 48} 150 ${92 - flap * 64} Q124 ${114 - flap * 18} 112 126 Z`} fill={c} stroke={dark} strokeWidth={2} />
{carry === "olive" && <Branch x={156} y={116} />}
</g>);
}
return body(<g>
<path d="M86 186 L84 200 M106 186 L108 200" stroke="#e07a4a" strokeWidth={4} strokeLinecap="round" />
<ellipse cx={96} cy={164} rx={36} ry={26} fill={c} />
<path d="M64 160 L36 150 L42 176 Z" fill={dark} />
<path d="M80 158 Q100 146 118 166 Q100 178 80 158 Z" fill={dark} />
<circle cx={128} cy={134} r={17} fill={c} />
<path d="M143 132 L160 137 L143 142 Z" fill={beak} />
<Eye x={132} y={130} r={3.4} />
{carry === "olive" && <Branch x={154} y={138} />}
</g>);
}
case "elephant": return body(<g>
<Leg x={52} y={128} len={70} w={26} fill={dark} swing={-ph * 10} />
<Leg x={128} y={128} len={70} w={26} fill={dark} swing={ph * 10} />
<ellipse cx={92} cy={112} rx={66} ry={50} fill={c} />
<Leg x={72} y={130} len={68} w={26} fill={c} swing={ph * 10} />
<Leg x={148} y={128} len={70} w={26} fill={c} swing={-ph * 10} />
<path d="M28 104 Q16 116 22 134" stroke={dark} strokeWidth={5} fill="none" strokeLinecap="round" />
<circle cx={154} cy={90} r={34} fill={c} />
<path d={`M176 98 Q192 128 182 158 Q178 ${170 + ph * 4} 190 ${172 + ph * 4}`} stroke={c} strokeWidth={16} fill="none" strokeLinecap="round" />
<path d="M130 70 Q100 74 104 108 Q116 132 140 116 Z" fill={dark} />
<path d="M172 112 L184 124" stroke="#f4f0e4" strokeWidth={6} strokeLinecap="round" />
<Eye x={166} y={84} r={4} />
</g>);
case "giraffe": return body(<g>
<Leg x={58} y={118} len={80} w={11} fill={dark} swing={-ph * 12} />
<Leg x={118} y={118} len={80} w={11} fill={dark} swing={ph * 12} />
<ellipse cx={90} cy={112} rx={44} ry={24} fill={c} />
<Leg x={70} y={120} len={78} w={11} fill={c} swing={ph * 12} />
<Leg x={128} y={118} len={80} w={11} fill={c} swing={-ph * 12} />
<path d="M116 100 L150 10 L166 16 L134 108 Z" fill={c} />
{[[80, 104], [100, 116], [66, 116], [104, 98], [138, 60], [148, 34], [130, 84]].map(([x, y], i) => <circle key={i} cx={x} cy={y} r={6} fill={shade(c, 0.62)} />)}
<ellipse cx={168} cy={14} rx={22} ry={12} fill={c} />
<path d="M156 0 L154 -14 M164 0 L164 -14" stroke={dark} strokeWidth={4} strokeLinecap="round" />
<Eye x={170} y={9} r={3.4} />
<path d="M46 104 Q36 120 40 136" stroke={dark} strokeWidth={3} fill="none" />
</g>);
case "lion": {
const mane = shade(c, 0.62);
return body(<g>
<Leg x={58} y={138} len={60} w={15} fill={dark} swing={-ph * 12} />
<Leg x={124} y={138} len={60} w={15} fill={dark} swing={ph * 12} />
<ellipse cx={92} cy={138} rx={52} ry={26} fill={c} />
<Leg x={72} y={140} len={58} w={15} fill={c} swing={ph * 12} />
<Leg x={136} y={138} len={60} w={15} fill={c} swing={-ph * 12} />
<path d={`M42 132 Q20 ${120 + ph * 6} 22 102`} stroke={c} strokeWidth={6} fill="none" strokeLinecap="round" />
<circle cx={22} cy={100} r={7} fill={mane} />
<circle cx={146} cy={112} r={34} fill={mane} />
<circle cx={150} cy={116} r={22} fill={c} />
<ellipse cx={164} cy={124} rx={9} ry={7} fill={shade(c, 1.15)} />
<circle cx={168} cy={121} r={3.4} fill={INK} />
<Eye x={156} y={108} r={3.4} />
</g>);
}
case "sheep": return body(<g>
<Leg x={70} y={150} len={50} w={9} fill="#3a3540" swing={-ph * 12} />
<Leg x={118} y={150} len={50} w={9} fill="#3a3540" swing={ph * 12} />
{[[66, 140], [86, 128], [108, 128], [126, 140], [96, 152], [76, 156], [116, 156]].map(([x, y], i) => <circle key={i} cx={x} cy={y} r={22} fill={c} />)}
<Leg x={82} y={160} len={40} w={9} fill="#2e2a33" swing={ph * 12} />
<Leg x={128} y={156} len={44} w={9} fill="#2e2a33" swing={-ph * 12} />
<ellipse cx={152} cy={128} rx={16} ry={20} fill="#3a3540" />
<ellipse cx={140} cy={116} rx={10} ry={5} fill="#3a3540" transform="rotate(-20 140 116)" />
<circle cx={146} cy={110} r={12} fill={c} />
<Eye x={158} y={124} r={3.2} light />
</g>);
case "horse": case "camel": {
const camel = species === "camel";
return body(<g>
<Leg x={60} y={116} len={84} w={13} fill={dark} swing={-ph * 14} />
<Leg x={124} y={116} len={84} w={13} fill={dark} swing={ph * 14} />
<ellipse cx={92} cy={110} rx={52} ry={28} fill={c} />
{camel && <path d="M62 92 Q76 50 96 88 Q110 54 126 92 Z" fill={c} />}
<Leg x={74} y={118} len={82} w={13} fill={c} swing={ph * 14} />
<Leg x={134} y={116} len={84} w={13} fill={c} swing={-ph * 14} />
<path d={camel ? "M132 100 Q160 96 158 60 L174 56 Q178 104 142 116 Z" : "M128 96 L152 50 L170 58 L146 112 Z"} fill={c} />
<ellipse cx={camel ? 178 : 168} cy={camel ? 56 : 56} rx={camel ? 17 : 22} ry={camel ? 11 : 13} fill={c} transform={`rotate(${camel ? 10 : 30} ${camel ? 178 : 168} 56)`} />
{!camel && <path d="M150 48 Q132 70 128 98" stroke={shade(c, 0.5)} strokeWidth={9} fill="none" strokeLinecap="round" />}
{!camel && <path d={`M42 104 Q24 ${120 + ph * 4} 30 146`} stroke={shade(c, 0.5)} strokeWidth={9} fill="none" strokeLinecap="round" />}
{camel && <path d="M42 106 Q34 120 38 134" stroke={dark} strokeWidth={4} fill="none" />}
<path d="M158 42 L156 30 L166 40 Z" fill={dark} />
<Eye x={camel ? 182 : 170} y={camel ? 52 : 50} r={3.4} />
</g>);
}
default: return null;
}
}