Files
CenaForge/cartoon/src/elements/nature.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

143 lines
8.1 KiB
TypeScript

// Peças da natureza: árvores, mato, pedras, montanha, nuvem, palmeira, ondas. Base em (0,0); luz da esquerda.
import React from "react";
import { mix, type Paint } from "./paint";
export type Draw = (p: Paint, color?: string) => React.ReactNode;
type Blob = [number, number, number];
/** Copa/moita/nuvem em 2 tons: tudo na cor da sombra, a parte de cima-esquerda na base e brilho nos topos. */
export function Foliage({ blobs, color, p, shadeK = 0.5, hiK = 0.14, lift = 0.16 }: { blobs: Blob[]; color: string; p: Paint; shadeK?: number; hiK?: number; lift?: number }) {
const cx = blobs.reduce((s, b) => s + b[0], 0) / blobs.length;
const cy = blobs.reduce((s, b) => s + b[1], 0) / blobs.length;
const top = Math.min(...blobs.map((b) => b[1] - b[2]));
return (
<g>
<g fill={p.lo(color, shadeK)}>{blobs.map(([x, y, r], i) => <circle key={i} cx={x} cy={y} r={r} />)}</g>
<g fill={p.c(color)}>{blobs.map(([x, y, r], i) => <circle key={i} cx={x - r * lift * 0.8} cy={y - r * lift} r={r * 0.8} />)}</g>
{hiK > 0 && <g fill={p.hi(color, hiK)}>
{blobs.filter(([x, y, r]) => x <= cx + 40 && y - r <= top + (cy - top) * 0.5).map(([x, y, r], i) => <circle key={i} cx={x - r * 0.24} cy={y - r * 0.3} r={r * 0.6} />)}
</g>}
</g>
);
}
const jitter = (p: Paint, blobs: Blob[], k = 1): Blob[] => blobs.map(([x, y, s]) => [x + (p.r() - 0.5) * 36 * k, y + (p.r() - 0.5) * 28 * k, s * (0.9 + p.r() * 0.2)]);
export const NATURE: Record<string, Draw> = {
tree: (p, color) => {
const leaf = color ?? p.pal.leaf;
const bark = p.pal.trunk;
const blobs = jitter(p, [[-210, -560, 150], [205, -575, 150], [0, -520, 170], [-100, -700, 175], [120, -710, 170], [5, -840, 150],
[-285, -660, 110], [285, -670, 105], [0, -660, 200]]);
return <g>
<path d="M-56 0 Q-30 -10 -30 -200 L-28 -400 L28 -400 Q30 -200 32 -10 Q50 0 62 0 Z" fill={p.c(bark)} />
<path d="M6 -2 Q20 -150 16 -400 L28 -400 Q30 -200 32 -10 Q50 0 62 0 Z" fill={p.lo(bark, 0.4)} />
<path d="M-12 -330 Q-90 -420 -170 -520 M8 -360 Q70 -460 150 -560 M0 -380 L-6 -560" stroke={p.c(bark)} strokeWidth={30} strokeLinecap="round" fill="none" />
<path d="M14 -364 Q76 -456 156 -552" stroke={p.lo(bark, 0.4)} strokeWidth={12} strokeLinecap="round" fill="none" />
<path d="M-20 -60 Q-14 -120 -18 -180 M-4 -240 Q2 -280 -2 -320" stroke={p.lo(bark, 0.3)} strokeWidth={5} strokeLinecap="round" fill="none" />
<Foliage blobs={blobs} color={leaf} p={p} />
</g>;
},
pine: (p, color) => {
const leaf = color ?? mix(p.pal.leaf, "#1f5a46", 0.35);
const tiers: [number, number, number][] = [[-200, -90, -440], [-165, -300, -640], [-125, -500, -840]];
return <g>
<rect x={-22} y={-110} width={44} height={110} fill={p.c(p.pal.trunk)} />
<rect x={4} y={-110} width={18} height={110} fill={p.lo(p.pal.trunk, 0.4)} />
{tiers.map(([w, b, t], i) => <g key={i}>
<polygon points={`0,${t} ${w},${b} ${-w},${b}`} fill={p.c(leaf)} />
<polygon points={`0,${t} ${-w},${b} ${-w * 0.1},${b}`} fill={p.lo(leaf, 0.42)} />
<polygon points={`0,${t} ${w * 0.55},${b - (b - t) * 0.42} ${w * 0.25},${b - (b - t) * 0.4}`} fill={p.hi(leaf, 0.2)} />
<path d={`M${w} ${b} L${-w} ${b} L${-w * 0.92} ${b - 18} L${w * 0.92} ${b - 18} Z`} fill={p.lo(leaf, 0.55)} />
</g>)}
</g>;
},
deadtree: (p, color) => {
const bark = color ?? p.pal.trunk;
return <g strokeLinecap="round" fill="none">
<g stroke={p.c(bark)}>
<path d="M0 0 L0 -440" strokeWidth={52} />
<path d="M0 -240 L-140 -400 M-80 -320 L-160 -300 M0 -340 L120 -500 M60 -420 L160 -430 M0 -440 L-40 -560" strokeWidth={24} />
</g>
<g stroke={p.lo(bark, 0.45)}>
<path d="M14 0 L14 -430" strokeWidth={18} />
<path d="M8 -346 L124 -496" strokeWidth={9} />
</g>
<path d="M-30 0 Q-60 4 -80 0 M30 0 Q60 4 84 0" stroke={p.c(bark)} strokeWidth={20} />
</g>;
},
bush: (p, color) => <Foliage blobs={jitter(p, [[-90, -70, 85], [15, -105, 105], [115, -66, 80], [-165, -42, 56], [180, -38, 52], [40, -50, 70]], 0.6)} color={color ?? p.pal.leaf} p={p} />,
rock: (p, color) => {
const s = color ?? p.pal.stone;
return <g>
<path d="M-120 0 Q-138 -84 -52 -118 Q34 -150 104 -84 Q146 -34 120 0 Z" fill={p.c(s)} />
<path d="M30 -134 Q96 -116 114 -66 Q140 -30 120 0 L6 0 Q44 -64 30 -134 Z" fill={p.lo(s, 0.38)} />
<path d="M-106 -40 Q-110 -98 -44 -116 Q-16 -124 6 -122 Q-44 -100 -66 -40 Z" fill={p.hi(s, 0.25)} />
</g>;
},
mountain: (p, color) => {
const m = color ?? p.pal.far;
return <g>
<polygon points="-520,0 -60,-470 0,-520 70,-460 520,0" fill={p.c(m)} />
<polygon points="0,-520 70,-460 520,0 80,0 150,-140 40,-260 60,-380" fill={p.lo(m, 0.3)} />
<polygon points="-60,-470 0,-520 -40,-400 -140,-250 -260,-150 -150,-300" fill={p.hi(m, 0.12)} />
<polygon points="-110,-410 -60,-470 0,-520 70,-460 110,-410 50,-432 10,-396 -40,-436" fill={p.c("#ffffff")} opacity={0.85} />
<polygon points="0,-520 70,-460 110,-410 50,-432 22,-410" fill={p.lo("#e8ecf4", 0.3)} opacity={0.85} />
</g>;
},
cloud: (p, color) => {
const base = color ?? mix("#ffffff", p.pal.light, 0.12);
return <g opacity={0.95}>
<Foliage blobs={[[-80, -50, 52], [0, -78, 66], [78, -52, 50], [-140, -34, 34], [140, -32, 32]]} color={base} p={p} shadeK={0.2} hiK={0} lift={0.22} />
<rect x={-174} y={-34} width={348} height={34} rx={17} fill={p.lo(base, 0.22)} />
</g>;
},
palm: (p, color) => {
const leaf = color ?? p.pal.leaf;
const bark = mix(p.pal.trunk, "#b08a5a", 0.35);
const fronds: [number, number][] = [[-250, -470], [-210, -600], [-40, -700], [150, -650], [270, -500], [60, -560]];
return <g>
<path d="M-22 0 Q-40 -260 20 -560 L52 -556 Q2 -260 26 0 Z" fill={p.c(bark)} />
<path d="M8 0 Q-6 -260 40 -558 L52 -556 Q2 -260 26 0 Z" fill={p.lo(bark, 0.4)} />
{Array.from({ length: 9 }, (_, i) => {
const y = -40 - i * 58;
const x = -14 + (i / 9) * 40 - Math.sin((i / 9) * 2) * 10;
return <path key={i} d={`M${x - 20} ${y} Q${x + 4} ${y + 10} ${x + 30} ${y}`} stroke={p.lo(bark, 0.5)} strokeWidth={6} fill="none" strokeLinecap="round" />;
})}
{fronds.map(([x, y], i) => {
const ox = 36;
const oy = -560;
const mx = (ox + x) / 2;
const my = Math.min(oy, y) - 70;
return <g key={i}>
<path d={`M${ox} ${oy} Q${mx} ${my - 34} ${x} ${y} Q${mx} ${my + 44} ${ox} ${oy} Z`} fill={p.c(leaf)} />
<path d={`M${ox} ${oy} Q${mx} ${my + 6} ${x} ${y} Q${mx} ${my + 44} ${ox} ${oy} Z`} fill={p.lo(leaf, 0.42)} />
</g>;
})}
<circle cx={24} cy={-540} r={20} fill={p.c("#6a4a2a")} /><circle cx={52} cy={-532} r={18} fill={p.lo("#6a4a2a", 0.3)} />
</g>;
},
outcrop: (p, color) => {
const s = color ?? mix(p.pal.stone, p.pal.ground.dirt, 0.5);
return <g>
<path d="M-330 0 Q-300 -70 -160 -96 Q0 -116 170 -94 Q310 -70 330 0 Z" fill={p.c(s)} />
<path d="M60 -110 Q200 -96 290 -60 Q320 -36 330 0 L40 0 Q110 -50 60 -110 Z" fill={p.lo(s, 0.32)} />
{[-30, -56, -78].map((y, i) => <path key={y} d={`M${-300 + i * 40} ${y} Q0 ${y - 22} ${300 - i * 40} ${y}`} stroke={p.lo(s, 0.5)} strokeWidth={5} fill="none" />)}
<path d="M-330 0 Q-300 -70 -160 -96 L-150 -80 Q-280 -50 -300 0 Z" fill={p.hi(s, 0.3)} />
</g>;
},
rainbow: () => {
const bands = ["#e8463d", "#f28c28", "#f2c230", "#5cc48a", "#4fb0e8", "#7a5ce0"];
return <g fill="none" opacity={0.78}>{bands.map((c, i) => <path key={c} d={`M${-600 + i * 26} 0 A${600 - i * 26} ${600 - i * 26} 0 0 1 ${600 - i * 26} 0`} stroke={c} strokeWidth={27} />)}</g>;
},
waves: (p, color) => {
const water = color ?? p.pal.ground.water;
const d = Array.from({ length: 7 }, (_, i) => `Q${-300 + i * 100 + 50} -70 ${-300 + (i + 1) * 100} 0`).join(" ");
return <g>
<path d={`M-300 0 ${d} L400 40 L-300 40 Z`} fill={p.lo(water, 0.3)} />
<path d={`M-300 6 ${d} L400 12 L-300 12 Z`} fill={p.c(water)} opacity={0.7} />
<path d={`M-300 0 ${d}`} stroke={p.hi("#ffffff", 0)} strokeWidth={9} fill="none" opacity={0.75} strokeLinecap="round" />
</g>;
},
};