Cartoon: corpo contínuo sem juntas e novas mãos em 2 camadas

This commit is contained in:
Mateuus
2026-11-18 04:50:20 -03:00
parent 393d1f74b2
commit e4a5bc026c
5 changed files with 1268 additions and 628 deletions
File diff suppressed because it is too large Load Diff
+247 -158
View File
@@ -1,187 +1,247 @@
// Biblioteca de MÃOS desenhadas (não montadas com cápsulas): cada forma é um desenho num quadro fixo de 120×120,
// com a silhueta inteira num path só (Bézier contínuas: dedos afinando em 3 falanges, nós em arco, polegar nascendo
// do montinho da base da palma), as linhas internas no tom escuro da pele, unhas, e uma sombra cel DESENHADA
// (recortada pela silhueta). O rig só ESCOLHE a forma, posiciona no pulso, gira e espelha.
//
// Regras de construção seguidas (ensino de desenho de mão): palma ≈ quadrada com laterais curvas; dedo médio ≈ altura
// da palma, médio o maior, indicador ≈ anelar, mínimo o menor; nós da base e pontas em ARCO (o médio mais à frente);
// dedo afina para a ponta; polegar com 2 segmentos e unha, girando em outro eixo; pulso mais estreito que a palma;
// volume com sombra no lado oposto à luz e embaixo dos dedos; linhas internas sempre curvas.
//
// Quadro canônico: braço da DIREITA da tela (s = 1), luz vinda da esquerda (sombra desenhada à direita/embaixo).
// - formas "alinhadas" (relaxed, open, point, fist, on_face): o antebraço chega por cima (pulso em (60, 4)) e os dedos
// apontam para +y; o polegar fica do lado −x. O rig gira pelo ângulo do antebraço.
// - formas "em pé" (thumbs_up, grip, pinch_edge): desenhadas na orientação da tela, com o pulso num canto e o ângulo
// do antebraço para o qual foram feitas (`wristDeg`); o rig só inclina um pouco para acompanhar o braço.
// Biblioteca de MÃOS desenhadas no estilo de ilustração cartoon de referência (quadro canônico 120×120):
// - Proporções cheias, compactas e arredondadas (como em referencia/recortes/joinha.png, maos-segurando.png,
// mao-prancheta.png e apontando.png): sem dedos compridos em salsicha;
// - Base do pulso cilíndrica arredondada centrada em `wrist` (emenda perfeita com o antebraço ou punho da manga);
// - Sulcos quentes e curtos entre os dedos dobrados, e sombreado cel limpo em 2 tons acompanhando o volume;
// - Camadas `back` (atrás do objeto) e `front` (dedos/polegar na frente do objeto) para que qualquer objeto seguro
// fique claramente DENTRO da mão.
import React from "react";
import type { IconId } from "./spec";
export const HAND_SHAPES = ["relaxed", "open", "point", "thumbs_up", "grip", "pinch_edge", "pinch_low", "fist", "on_face"] as const;
export const HAND_SHAPES = [
"relaxed",
"open",
"point",
"thumbs_up",
"grip",
"pinch_edge",
"pinch_low",
"fist",
"on_face",
"think",
"crossed",
] as const;
export type HandShape = (typeof HAND_SHAPES)[number];
type ShapeDef = {
/** Silhueta inteira (um path). */
/** Silhueta principal (camada de trás quando `bodyBehind` é true). */
body: string;
/** Sombra cel desenhada (recortada pela silhueta do corpo). */
/** Sombra cel em crescente macio (recortada pela silhueta `body`). */
shadow: string;
/** Linhas internas do corpo: separação dos dedos, nós, dobras. */
/** Linhas internas quentes: separação dos dedos, nós e dobras da palma. */
lines: string;
/** Peça por cima (polegar dobrado por cima dos dedos ou do objeto), com sombra e linhas próprias. */
/** Peça por cima (polegar ou dedos que abraçam o objeto pela frente), com sombra e linhas próprias. */
over?: { body: string; shadow?: string; lines?: string };
/** Unhas: [cx, cy, rx, ry, giro]. A primeira do corpo, as de `overNails` por cima. */
/** Unhas discretas (só quando a vista pede): [cx, cy, rx, ry, giro]. */
nails?: [number, number, number, number, number][];
overNails?: [number, number, number, number, number][];
/** Pulso no quadro (onde encosta o fim do antebraço). */
/** Pulso no quadro (centro da junta redonda onde termina o antebraço). */
wrist: [number, number];
/** Ângulo do antebraço para o qual a forma foi desenhada (0 = descendo; formas alinhadas = 0). */
wristDeg: number;
upright: boolean;
/** Com objeto: o corpo fica ATRÁS do objeto (só a peça `over` na frente) — pinch_edge. */
/** Com objeto: `body` fica ATRÁS do objeto e `over` fica NA FRENTE dele (objeto dentro da mão). */
bodyBehind?: boolean;
/** Onde fica o objeto: cabo (grip) ou borda (pinch_edge). */
/** Ponto onde passa o cabo (`grip`) ou encosta a borda (`pinch_edge`/`pinch_low`). */
hold?: [number, number];
};
// Pulso: cilindro com ≈ 60 % da largura da palma (27 unidades), centrado no ponto `wrist`, com uma sobra de 10
// unidades que entra por baixo da manga (fica escondida pelo punho da manga). Sombra do lado oposto à luz (direita):
// no pulso ela tem a mesma largura da sombra do antebraço (≈ 1/3) e vai afinando na borda da mão; sob os dedos dobrados
// e sob o polegar.
const WRIST_TOP = "M46.5 -10 L46.5 3";
const WRIST_RIGHT_END = "C74.4 6.5 73.6 3 73.5 0 L73.5 -10 Z";
// Base redonda no pulso (centro (60, 0), raio ~13.5): garante emenda contínua em qualquer rotação.
const WRIST_CAP = "M46.5 0 A13.5 11 0 0 1 73.5 0";
const SHAPES: Record<HandShape, ShapeDef> = {
// Caída ao lado do corpo, vista pelo dorso: dedos juntos levemente curvos (nós e pontas em arco), polegar na frente.
// Caída ao lado do corpo: formas arredondadas e carnudas, polegar voltado para dentro, dedos juntos curvando suavemente.
relaxed: {
body: `${WRIST_TOP} C45.5 12 41 18 38.5 25 C35.5 33 34 42 35 50 C35.8 57 38.5 61 42 60.5 C45 60 46 57 45.6 53 C45.3 49 45 46 44.8 44`
+ " C43.6 52 42.8 62 43 72 C43.2 79 45.2 82.5 48.3 82.5 C51.3 82.5 52.6 80 52.6 76.5 L52.8 74 C53 80 53.4 86 55.2 89"
+ " C56.6 91.6 60 92 61.8 89.8 C63 88 63.2 85 63.2 81 L63.4 78 C63.8 82 64.6 85.5 66.4 87.2 C68.4 89 71.4 88.2 72.2 85.4"
+ " C72.8 83 72.8 80 72.6 77 L72.8 74 C73.8 76.5 75.4 78 77.4 77.6 C79.6 77 80.6 74.6 80.7 71.5 C81 64 81.8 54 82 46"
+ ` C82.2 34 79.5 20 75.5 10 ${WRIST_RIGHT_END}`,
shadow: "M64.6 -12 L65 1 C69 6 75 12 78 22 C79.6 32 80 42 79.6 52 C79.2 62 78.6 70 78.8 76 L96 80 L96 -12 Z"
+ " M40 77 C48 84.5 62 90.5 80 76 L80 100 L40 100 Z M45.2 45 C46.6 52 47 59 46.6 65 L49.6 66 C49.8 58 49.2 50 47.6 44 Z",
lines: "M52.8 74 C52.7 68 52.8 62 53.2 56 M63.4 78 C63.4 71 63.2 64 63 57 M72.8 74 C73 68 73.4 62 73.8 55 M44.8 44 C44.5 38 43 32 41 27",
nails: [[40.6, 54.2, 2.8, 3.8, 6]],
body: `${WRIST_CAP}`
+ " C76 8 82.5 18 84 31 C85.2 43 84.4 55 82 65 C80.8 70.5 77.8 73.5 74.5 73 C72.2 72.6 70.8 70.5 70.4 67.5"
+ " C69.8 74 68 79 64.2 79.6 C60.8 80.2 58.6 77.5 58.2 73"
+ " C57.4 78.5 55.2 82 51.2 82 C47.5 82 45.4 78.5 45.2 73.5"
+ " C44.2 76.5 42 78 39.2 77.4 C35.8 76.6 34.2 72.5 34.8 66 C35.5 57 37.2 48 39 41"
+ " C37 46.5 35 51.5 32.2 54 C29 56.8 25 55.5 24.2 51 C23.2 45.8 25.5 37.5 29.5 29.5"
+ " C34 21 41 13.5 45 5.5 C46 3.5 46.5 1.8 46.5 0 Z",
shadow: "M66 -10 C69 5 75.5 16 78 30 C79.8 43 78.8 56 76 67 C72.5 75 62 80 44 78 L44 90 L92 90 L92 -10 Z",
lines: "M39 41 C40.8 35 41.5 28.5 40.5 22.5 M45.2 73.5 C45.8 65.5 46.8 58 48.2 52 M58.2 73 C58.8 65 59.5 57.5 60.2 51.5 M70.4 67.5 C71 61 71.6 55 72 50",
wrist: [60, 0], wristDeg: 0, upright: false,
},
// Aberta, palma para a câmera (acenando): dedos levemente abertos, polegar saindo da eminência tenar.
// Mão aberta (acenando / comemorando): palma carnuda, dedos abrindo em leque macio que afinam na ponta, polegar na base.
open: {
body: `${WRIST_TOP} C44 12 39 18 35 22 C29 26 24 31 21 37 C18.5 42 19.5 47 23.5 47.5 C26.5 48 28.5 45.5 30 42.5 C32.5 38 35.5 35 38.5 34.5`
+ " C39 38 39.2 41 39.5 44 C38.6 54 38 64 38.4 72 C38.6 78 41 80.6 44 80.4 C47 80.2 48.4 78 48.4 74.6 C48.6 64 48.8 55 49.4 47.5"
+ " C50.4 58 50.8 70 51.2 80 C51.4 86 54.2 88.6 57.2 88.4 C60.2 88.2 61.6 85.6 61.4 82 C61 70 60.8 58 61.2 48"
+ " C62.6 58 63.6 68 64.4 76 C64.8 81.4 67.6 83.6 70.4 83 C73 82.4 74 79.8 73.6 76.6 C72.6 66 72 56 72 47.4"
+ " C73.8 54 75.6 61 77.6 66.6 C79 70.6 82 71.6 84.2 70 C86 68.6 86 66 85.2 63 C83 54 82.6 42 81.6 30 C80.6 18 76 8 73.5 2 L73.5 -10 Z",
shadow: "M64.6 -12 L65 1 C70 6 77 14 80.6 32 C81.6 44 82 54 83.4 64 L96 64 L96 -12 Z M50 30 C56 36 66 38.4 75 34 C70 42 60 44.4 51 40 Z"
+ " M45.6 50 C46.2 60 46.4 70 46 80.4 L49 80 L49.2 50 Z M58.4 50 C58.8 62 59.2 74 59 88.4 L62 88 L61.6 50 Z M70.4 50 C71.2 60 71.8 70 72 82 L74.6 81 L73.6 50 Z",
lines: "M48 46 C58 42.4 70 42.4 80 46 M42 40 C46 32 50 22 52 12",
body: `${WRIST_CAP}`
+ " C75.5 7 81.5 16 83.8 28 C85 35 86 43 88 51.5 C89.2 56.8 88 61.2 84.8 62.2 C81.5 63.2 78.6 60.4 76.6 55"
+ " C74.8 50.2 73.2 45.2 71.8 41.2 C73 50 74.2 60.5 74.6 68.8 C74.9 74.6 72.2 78.2 68.4 78.2 C64.8 78.2 62.6 74.8 62.2 69"
+ " C61.8 60.5 61.2 51.5 60.8 44 C60.5 54 60.2 65.5 59.6 74.2 C59.2 80.4 56.2 83.6 52.2 83.4 C48.4 83.2 46.2 79.6 46.2 73.5"
+ " C46.2 64.5 46.8 54 47.5 44.5 C46 52.5 44.5 61.5 43.5 68.5 C42.6 74 39.6 76.8 36 76.2 C32.4 75.5 30.8 72 31.5 66.2"
+ " C32.8 56 35.2 44.5 37.5 35 C33.5 38.8 29.2 42.8 25 45.5 C20.8 48.2 16.4 47 15.2 43 C14 39 16.5 34 21.2 30.2"
+ " C27.2 25.4 34.8 20.8 40.2 14.5 C43.8 10.2 46 5 46.5 0 Z",
shadow: "M67 -10 C70 5 77 16 80 30 C82 40 83.5 50 86 60 L96 60 L96 -10 Z"
+ " M46 28 C53 33.5 63 35.5 72 32 C68 38.5 57 40.5 47 35.5 Z",
lines: "M43 37 C53 34 64.5 34.5 73.5 38.5 M38.5 34 C42.8 28 46 21 47 14",
wrist: [60, 0], wristDeg: 0, upright: false,
},
// Apontando, vista pelo lado da palma: indicador esticado (3 falanges, afinando, unha na ponta, leve curva); médio,
// anelar e mínimo dobrados como gomos empilhados em arco (médio mais à frente), com a ponta virada para a palma e a
// UNHA de cada um aparecendo; o polegar fecha por cima do médio, com a unha dele.
// Apontando (como em referencia/recortes/apontando.png):
// Polegar redondo na lateral interna (esquerda), indicador comprido subindo firme ao lado dele,
// e os 3 outros dedos (médio, anelar, mínimo) dobrados em escada arredondada macia na direita.
point: {
body: `${WRIST_TOP} C45 12 40 18 37.5 26 C36 34 36.2 42 38.2 48 C37.8 60 37.9 72 38.5 82 C39 90 39.6 96 40.6 101.4`
+ " C41.4 106.6 46 108.4 49.2 106 C51.6 104.2 52.2 100.4 52.2 96.6 C52.2 88 52.6 76 53.4 64"
+ " C54 68.6 56.8 71 60.6 70.6 C64 70.2 65.6 67.6 65.8 64.8 C68 68 71.6 68.4 74 66.6 C76 65 76.4 62 76 59.8"
+ ` C78.4 60.6 81 59.4 81.8 56.4 C82.6 53 82.4 49 82 46 C82 34 79.5 20 75.5 10 ${WRIST_RIGHT_END}`,
shadow: "M64.6 -12 L65 1 C70 6 78 14 80.8 30 C81.6 40 81 48 79.6 52 C76 50 70 49 64 50 L96 50 L96 -12 Z"
+ " M50 66 C56 72.6 68 72 74 68 C78 66 81 62 83 56 L86 80 L48 80 Z M49.6 66 C50.2 78 50.6 92 50.2 108 L58 108 L58 66 Z"
+ " M44 58 C48 62 52 64.4 56.4 63.6 L58 67 L44 64 Z",
lines: "M65.8 64.8 C65.4 60.6 64.4 57.6 62.8 55.4 M76 59.8 C75.4 56 74.2 53.4 72.6 51.6 M53 57.4 C60 53.6 70 51.4 81 47"
+ " M38.8 81 Q45.4 82.6 52.4 81 M40.2 93 Q46 94.4 52.2 93",
nails: [[59.6, 66.6, 3.2, 2.4, 6], [70.8, 63.4, 2.9, 2.2, -8], [79.2, 54.6, 2.3, 1.9, -30], [45.8, 102, 3, 3.6, -4]],
body: `${WRIST_CAP}`
+ " C76 8 82.5 18 84.5 30 C86 39 86.5 48 84 55.5 C82 61 77.2 63.5 72.5 61.5"
+ " C71 66.8 66.2 69.8 60.8 68.6 C58 68 55.8 66 54.6 63.5"
+ " C53 67.5 51 69.5 48.8 69.5 C48.8 79.5 48.8 90.5 48.4 98.5"
+ " C48 105.5 44.2 109.2 39.4 109 C34.6 108.8 31.4 104.6 31.8 97.5"
+ " C32.4 85 33.8 69.5 35 55.5 C29 51.5 25 44.5 25.8 36.2 C26.6 28 32.2 21 38.8 15.2"
+ " C43.2 11 45.8 5.2 46.5 0 Z",
shadow: "M65 -10 C68.5 5 76 15 79 29 C81 39 80.5 49 78 56 C73 60.5 63 64.5 50 65.5 L50 75 L93 75 L93 -10 Z"
+ " M42.8 58 C44.2 72 44.2 88 43.2 109 L49.5 109 L49.5 58 Z",
lines: "M50.5 68.5 C50.8 60.5 51.6 53 53.5 47.5 M61.8 68 C62.4 60 63.2 53 64.8 47.5 M72.5 61.5 C73.2 55 74 49 75.2 44.5"
+ " M49 48.5 C57.5 46 67.5 44.5 78 43",
over: {
body: "M38.4 30 C42 38 47 46 52.8 52 C56.2 55.4 57 60 54 61.6 C51 63.2 47.4 60.4 44.4 56.6 C40.8 52 38 46 37.6 40 Z",
shadow: "M39.6 46 C42 51 46 56 50 59 L46 62 L38 52 Z",
body: "M25.8 36.2 C26.6 27.5 33.8 21 41.2 24.2 C47 26.8 52.2 34.5 55.5 42.2 C58.5 49 57.5 56.5 52.2 58.8 C47 61.2 39.2 57.8 33.2 51.5 C27.8 45.8 25.2 41.2 25.8 36.2 Z",
shadow: "M28.5 43.5 C33.8 50.8 42.2 56.5 50.5 58 L47.5 62 L26.5 48.5 Z",
lines: "M35 27.5 C41.2 32.5 48 39.5 52.5 46.5",
},
overNails: [[53.2, 57.2, 3, 2.6, 40]],
wrist: [60, 0], wristDeg: 0, upright: false,
},
// Joinha: punho de lado, os 4 dedos dobrados na horizontal (um em cima do outro, nós e pontas na frente),
// polegar grosso saindo do topo, com unha, levemente inclinado para trás. Antebraço chegando de baixo, na diagonal.
// Joinha (proporção compacta e redonda idêntica a referencia/recortes/joinha.png):
// Punho cheio e arredondado (largura ~52, altura ~56 na palma), 4 dedos gordinhos empilhados com sulcos curtos,
// e polegar forte subindo na vertical do topo da palma.
thumbs_up: {
body: "M56 42 C46 39.5 34 40 29 44.5 C24.6 48.6 25.2 54.4 29.6 56 C25.2 58.6 24.8 65.4 29.4 67.8 C25.8 70.6 26.4 77.6 31 79.4"
+ " C28.6 82.6 30.6 88.4 36 89.4 C46 91.2 60 92.6 72 93.6 C78 94.4 83 97.2 86.5 101.5 L93.6 108.6 L112.6 89.6 L105.5 82.5"
+ " C101 77.6 96 70.4 92 61 C89.4 54.4 85 48 78 45 C77.6 40 76.8 30 75.4 20 C74.4 13 71.6 7 66 6.4"
+ " C60.6 5.8 57.4 9.6 56.8 15.6 C56.2 24 55.8 33 56 42 Z",
shadow: "M84 46 C90 52 95 62 98 72 L104 82 L120 96 L120 40 Z M28 54.6 C38 57.8 50 58 60 56.6 L60 59.6 C48 61 38 60.6 28 58 Z"
+ " M28 66.4 C38 69.6 50 70 60 68.6 L60 71.6 C48 73 38 72.6 28 70 Z M30 78 C40 81 50 81.6 58 80.6 L58 83.6 C48 84.6 40 84 30 81.4 Z"
+ " M30 88 C46 92 62 94 74 95 L86 104 L40 104 Z M71 8 C74 14 76 24 77 40 L84 44 L84 4 Z",
lines: "M29.6 56 C38 58 48 58.4 58 57 M29.4 67.8 C38 70 48 70.4 58 69 M31 79.4 C39 81.4 48 81.8 56 81"
+ " M58 57 C62 55.6 64.6 52.6 65.4 49 M58 69 C62.6 67.6 65.6 64.6 66.4 60.6 M56 81 C60.4 80 63.4 77.4 64.4 73.6 M57 34.5 C62 37 70 37.4 77 33.6",
nails: [[65.4, 13.8, 5, 6, 4]],
wrist: [96, 92], wristDeg: 135, upright: true,
body: "M74 88 A13.5 13.5 0 0 0 90 66"
+ " C87 57 82 49 75 43"
+ " C75.5 32 75 19 73 10.5 C71.2 3.5 66.5 0 60.5 0.5 C54.8 1 51.2 6 51 14.5"
+ " C50.8 23.5 51.2 32.5 50 39 C41 38.5 33 40 29.5 45.5 C26.2 50.6 27.8 57 33 58.8"
+ " C27.2 61.2 26.8 68.8 32.2 71.6 C28.2 74.4 28.8 81.8 34 84"
+ " C31.8 87.5 34.2 93.8 41 95 C51 96.8 63 96 70.5 91.5 C72.5 90.2 73.5 89 74 88 Z",
shadow: "M67 2 C70.8 10 72 25 72 41 C78.5 46 84 55 87 65 L92 74 L74 92 L34 97 L30 89"
+ " C44 93.5 59 93 68.5 88.5 C75.5 85 78.5 76 77 65 C75.5 54 72 46.5 66 42.5 L66 2 Z"
+ " M31.5 57.2 C40.5 59.8 50.5 60 59 58.5 L59 61.2 C49.5 62.6 40.5 62.2 31 59.8 Z"
+ " M31 70 C40 72.6 50.5 72.8 59 71.2 L59 74 C49.5 75.4 40 75 30.5 72.6 Z"
+ " M33 82.4 C41.5 84.8 50 85 57.5 83.8 L57.5 86.5 C49 87.6 41.5 87.2 32.5 85 Z",
lines: "M33 58.8 C41 60.8 50 61 58 59.5 M32.2 71.6 C40.5 73.6 50 73.8 58 72.2 M34 84 C41.8 85.8 49.5 86 56.5 84.8"
+ " M51 36.5 C56.5 39.8 64.5 40.2 71.5 37.5",
wrist: [82, 76], wristDeg: 135, upright: true,
},
// Punho em volta de um cabo (martelo, régua, ramo, celular): o cabo passa por dentro, o polegar fecha por cima.
// Punho segurando um cabo ou prancheta (proporção compacta e redonda idêntica a referencia/recortes/mao-prancheta.png):
// - `body` (atrás do cabo): base da palma;
// - `over` (na frente do cabo): mão redonda e carnuda com 4 dedos roliços empilhados e 3 sulcos curtos.
grip: {
body: "M44 42 C34 41.6 26.6 43.6 26.2 49 C25.8 53.4 26.8 55.6 29.6 56 C25.2 58.6 24.8 65.4 29.4 67.8 C25.8 70.6 26.4 77.6 31 79.4"
+ " C28.6 82.6 30.6 88.4 36 89.4 C48 91.4 64 92 76 89.6 C86 87.4 92.6 80 94.4 70 C96 62 100 55 105.5 49.5 L112.6 42.4 L93.6 23.4 L86.5 30.5"
+ " C80 36 72 39.6 62 41 C56 41.8 50 42 44 42 Z",
shadow: "M86 34 C92 44 95 58 94 70 C92 82 84 90 74 92 L120 120 L120 30 Z M28 54.6 C38 57.8 50 58 60 56.6 L60 59.6 C48 61 38 60.6 28 58 Z"
+ " M28 66.4 C38 69.6 50 70 60 68.6 L60 71.6 C48 73 38 72.6 28 70 Z M30 78 C40 81 50 81.6 58 80.6 L58 83.6 C48 84.6 40 84 30 81.4 Z"
+ " M30 88 C46 92 62 93 78 90 L78 100 L30 100 Z",
lines: "M29.6 56 C38 58 48 58.4 58 57 M29.4 67.8 C38 70 48 70.4 58 69 M31 79.4 C39 81.4 48 81.8 56 81"
+ " M58 57 C62 55.6 64.6 52.6 65.4 49 M58 69 C62.6 67.6 65.6 64.6 66.4 60.6 M56 81 C60.4 80 63.4 77.4 64.4 73.6",
body: "M88 77 A13.5 13.5 0 0 0 88 50"
+ " C81 44 71 40 59 40 C47 40 37 43 33.5 51 C30 59 31 73 36 83"
+ " C41 91 54 93 67 90 C77 87.5 84 83 88 77 Z",
shadow: "M76 44 C83 52 86 64 83 75 C80 84 72 90 60 92 L92 92 L92 44 Z",
lines: "",
over: {
body: "M80 36 C72 30.6 58 29.6 46 32.6 C37 34.8 33.4 40.6 36.6 44.2 C40.6 47.6 52 46.6 62 45.6 C70 44.8 76 43 79 40.6 Z",
shadow: "M36 43 C44 46.6 58 46.4 72 44 L72 48 L36 48 Z",
body: "M86 48 C79 38 66 33.5 53 34 C41 34.5 33 38 30.5 44.5 C28.5 49.5 30.2 53.5 34.5 55.2"
+ " C28 57 26 63 29.5 68 C31 70 33 71 35.5 71.6"
+ " C29.5 73.8 29 80.5 34 83.5 C32 86.8 34.2 92.5 41 93.8"
+ " C51.5 95.8 65 95 75 90.5 C83 87 88 81 89.5 74 C91 66 90 55 86 48 Z",
shadow: "M76 41 C84 49 87.5 61 85 73 C82 83 73.5 90 61.5 92.5 C49.5 95 39 94 32 90.5 L32 97 L92 97 L92 41 Z"
+ " M33.5 53.8 C42 56.2 52.5 56.2 61 54.5 L61 57.2 C52 59 41.5 58.8 32.5 56.2 Z"
+ " M33.8 70.2 C42 72.5 52 72.8 60 71.2 L60 74 C51 75.5 41 75 32.8 72.8 Z"
+ " M33.5 82.2 C41.5 84.5 51 84.8 58.5 83.5 L58.5 86.2 C50 87.5 40.5 87.2 32.5 84.8 Z",
lines: "M34.5 55.2 C43 57.2 53 57 60.5 55.2 M35.5 71.6 C43.5 73.6 52.5 73.8 59.5 72.2 M34 83.5 C42 85.5 50.5 85.8 57.5 84.5",
},
overNails: [[40.6, 39.4, 4.2, 3.6, -12]],
wrist: [96, 40], wristDeg: 45, upright: true, hold: [44, 66],
wrist: [86, 64], wristDeg: 45, upright: true, bodyBehind: true, hold: [44, 65],
},
// Segurando a borda de um objeto largo (em par): dedos atrás do objeto, polegar grosso por cima da frente dele.
// Antebraço chegando de cima, por fora (pose hold_both).
// Segurando a borda lateral de um objeto largo (proporção redonda e compacta idêntica a referencia/recortes/maos-segurando.png):
// - `body` (atrás): palma arredondada que apoia por trás do objeto;
// - `over` (na frente da borda): mão redonda e gordinha (`largura ~50, altura ~58`) com 4 dedos roliços e 3 sulcos curtos!
pinch_edge: {
body: "M56 32 C62 27 72 26.6 80 30.6 C83.6 32.6 85.6 37 87 42 L94.4 35.3 L112.4 55.3 L105 62 C102 70.4 97 78 90 83.4"
+ " C82.6 89 72.6 92 64 90.6 C58.6 89.6 55.6 86 55 80 C54 64 54 46 56 32 Z",
shadow: "M82 30 C90 38 94 50 94 62 C92 74 86 82 76 88 L120 120 L120 20 Z M55 78 C60 86 70 90 84 88 L84 96 L54 96 Z",
lines: "M56 46 C62 46 68.6 47.6 74 50.6 M55.6 60 C61.4 60.4 67.6 62 73 64.8 M55.6 73.6 C60.6 74 65.4 75.6 69.6 78",
body: "M88 73 A13.5 13.5 0 0 0 88 46"
+ " C81 39 70 35 59 36 C47 37 40 44 40 58 C40 72 45 83 54 88"
+ " C63 93 75 91 83 83 C86 79.5 87.5 76 88 73 Z",
shadow: "M76 40 C83 48 86 60 83.5 72 C81 82 73 88 61 90 L92 92 L92 40 Z",
lines: "",
over: {
body: "M70 46 C62 40 52 34.6 45 31.6 C38.4 28.8 33 32.4 35 38.4 C37.4 45 46.4 51 55.6 57 C62 61 70.4 57.6 70 46 Z",
shadow: "M36.4 40.6 C43 47 52 53 60 58 L68 58 L68 64 L34 46 Z",
body: "M85 44 C77 34 63 30 49 31.5 C37.5 32.8 30.5 38.5 32.5 45.8"
+ " C26.8 48 25 55.2 30 59.5 C25 62.2 24.8 70 30.5 73.5"
+ " C27.2 77.2 29.2 84.5 36 87 C46 90.5 60 91 72 87"
+ " C80.5 84 86.5 78 88.2 70.5 C90 62 89 51 85 44 Z",
shadow: "M75 38 C83 47 86.5 59.5 84 71.5 C81.5 81.5 73 87.5 60.5 89 C47.5 90.5 37 88 31.5 83.5 L31.5 93 L92 93 L92 38 Z"
+ " M32 44.5 C40.5 47.2 50.5 47.5 58.5 46 L58.5 48.8 C49.5 50.2 39.5 50 31 47.2 Z"
+ " M29.5 58.2 C38 61 48 61.2 56 59.8 L56 62.5 C47 64 37 63.8 28.5 61 Z"
+ " M30 72.2 C38.5 74.8 48 75 55.5 73.6 L55.5 76.4 C46.5 77.8 37.5 77.5 29 75 Z",
lines: "M32.5 45.8 C41 48 50.5 48.2 58 46.8 M30 59.5 C38.5 61.8 48 62 55.5 60.5 M30.5 73.5 C38.8 75.8 47.8 76 54.8 74.6",
},
overNails: [[39.8, 35.2, 4.2, 3.6, 30]],
wrist: [96, 52], wristDeg: 48, upright: true, bodyBehind: true, hold: [56, 52],
wrist: [85, 60], wristDeg: 62, upright: true, bodyBehind: true, hold: [44, 60],
},
// A mesma pegada de borda com o antebraço chegando de baixo (close de mãos segurando um livro aberto).
// Pegada de borda com o antebraço vindo de baixo (HandsInsert): dedos atrás da página e polegar comprido + palma na frente.
pinch_low: {
body: "M56 30 C64 25 78 26 85 34 C90 41 93 52 95 62 C96.6 70 100 78 105.5 86.5 L112.6 93.6 L93.6 112.6 L86.5 105.5"
+ " C80 98 72 94.6 66 92.4 C59 90 56 85.6 55 79 C53.6 64 53.6 44 56 30 Z",
shadow: "M80 28 C90 40 94 56 96 68 C98 78 102 84 110 92 L120 120 L120 20 Z M55 78 C60 86 68 91 80 96 L80 104 L54 100 Z",
lines: "M56 46 C62 46 68.6 47.6 74 50.6 M55.6 60 C61.4 60.4 67.6 62 73 64.8 M55.6 73.6 C60.6 74 65.4 75.6 69.6 78",
body: "M84 106 A14 14 0 0 0 104 86"
+ " C99 76 95 64 92 52 C89 39 81 28 69 26 C59 24.5 52 30 51 40"
+ " C49.5 55 50 72 54 84 C58 93 69 98 84 106 Z",
shadow: "M78 28 C88 39 92 55 95 70 C97 80 100 86 105 92 L112 104 L76 108 L54 90 C66 93 78 90 83 80 C88 68 85 45 78 28 Z",
lines: "M52 44 C59 44.5 66.5 46.5 72.5 50 M51.5 58 C58.5 58.8 65.5 60.8 71.5 64 M52.5 72 C58.5 72.8 64.5 74.8 69.5 78",
over: {
body: "M70 46 C62 40 52 34.6 45 31.6 C38.4 28.8 33 32.4 35 38.4 C37.4 45 46.4 51 55.6 57 C62 61 70.4 57.6 70 46 Z",
shadow: "M36.4 40.6 C43 47 52 53 60 58 L68 58 L68 64 L34 46 Z",
body: "M84 106 A14 14 0 0 0 104 86"
+ " C98 76 91 64 82 54 C72 44 56 34 45 30.5 C36.5 27.8 30.5 32.5 33 40"
+ " C35.5 47.5 45 54.5 55 61 C61 65 65 73 68 84 C71 94 77 101 84 106 Z",
shadow: "M34 41 C42 49 52 56 60 62 C65 68 68 78 72 90 L98 106 L82 110 L62 92 L32 46 Z",
lines: "M56 61 C62 64 67 69 70 76",
},
overNails: [[39.8, 35.2, 4.2, 3.6, 30]],
wrist: [96, 96], wristDeg: 135, upright: true, bodyBehind: true, hold: [56, 52],
wrist: [94, 96], wristDeg: 135, upright: true, bodyBehind: true, hold: [56, 52],
},
// Fechada, vista pelo lado da palma: os 4 dedos dobrados como gomos em arco (médio mais à frente, mínimo menor),
// com a ponta virada para a palma e a UNHA de cada um; o polegar fecha por cima do indicador e do médio.
// Punho fechado: 4 dedos dobrados em arco macio, polegar travando por cima do indicador e do médio.
fist: {
body: `${WRIST_TOP} C45 12 40 18 37.5 26 C36 34 36.2 42 38 50 C39.4 57 42.4 62 46.6 63.6 C50 65 53.2 64 54.4 61.4`
+ " C56 66.4 60 69 64 68.4 C67.4 67.8 69 65.2 69.2 62.4 C71.4 65.8 75 66.2 77.4 64.2 C79.4 62.4 79.8 59.4 79.4 57"
+ ` C81.6 57 82.6 53 82.4 48 C82.2 34 79.5 20 75.5 10 ${WRIST_RIGHT_END}`,
shadow: "M64.6 -12 L65 1 C70 6 78 14 80.8 30 C81.6 40 81 46 80 50 L96 50 L96 -12 Z M40 58 C48 68 66 72 82 54 L84 80 L38 80 Z",
lines: "M54.4 61.4 C53.8 57 52.4 54 50.6 52 M69.2 62.4 C68.8 58.4 67.6 55.6 66 53.6 M79.4 57 C78.6 53.6 77.4 51.2 75.8 49.6 M44 51 C54 47.6 68 45.6 81 43.6",
nails: [[46, 59.6, 3, 2.3, 10], [62.6, 64.4, 3.2, 2.4, 0], [74.2, 61.2, 2.8, 2.1, -10], [80, 53, 2.2, 1.8, -30]],
body: `${WRIST_CAP}`
+ " C75.5 8 81 18 82.8 30 C84.2 40 84.2 50 81.5 56.5 C79.2 61.5 75.2 63.2 71.5 61.8"
+ " C69.8 66.2 65.5 68.5 60.8 67.6 C58.2 67 56.2 65.2 55 62.8"
+ " C53.2 66.8 48.8 68.8 44.2 67.6 C39.5 66.4 36.2 62.2 35 55.5"
+ " C33.2 46 33.5 35 36.5 25.5 C39.5 16.5 44 9 46.2 2.5 C46.4 1.5 46.5 0.8 46.5 0 Z",
shadow: "M65 -10 C68 5 75 15 78 29 C80 40 79 50 75 57 C68 63 54 66 38 62 L38 74 L92 74 L92 -10 Z",
lines: "M46 67 C46.2 59.5 47 52.5 48.8 47 M60.8 67.6 C61.2 60 61.8 53 63.4 47.5 M71.5 61.8 C72 55.5 72.6 49.5 73.8 45"
+ " M42 48.5 C53 45.8 65 44.5 76.5 43.2",
over: {
body: "M38 30 C42 39 48 47 55 52 C59 54.6 60.4 59 57 60.6 C53 62.4 47.6 59 43.6 54.6 C39.8 50.4 37.4 42 38 30 Z",
shadow: "M39.4 46 C42.6 52 47 57 52 60 L48 63 L38 52 Z",
body: "M35.5 28 C41 34 49 41 55.5 46.5 C60.2 50.5 61 56.8 56.5 59.8 C52 62.8 44.8 60 39.5 54.2 C34.5 48.8 32.5 39.5 35.5 28 Z",
shadow: "M35 44 C39.5 51 46.5 56.5 54 58.5 L50 62.5 L33 50 Z",
},
overNails: [[56.6, 56.8, 3.1, 2.7, 35]],
wrist: [60, 0], wristDeg: 0, upright: false,
},
// Apoiada no rosto (queixo, boca, lateral da cabeça): dorso, dedos juntos e mais retos, polegar recolhido.
// Mão no rosto (tapar a boca / facepalm): palma arredondada e macia, dedos unidos em concha com sulcos curtos nas pontas.
on_face: {
body: `${WRIST_TOP} C45.5 12 41.5 18 39.5 25 C37.5 32 37.5 40 39 46 C39.5 58 39.6 70 40.4 82 C40.8 88 43.4 91.4 46.4 91.2`
+ " C49.4 91 50.6 88.4 50.8 85 L51 83 C51.4 90 53.6 94.4 57 94.4 C60.4 94.4 62 91.4 62.2 87.6 L62.3 85.6 C63 91 65.4 93.4 68.4 93"
+ " C71.4 92.6 72.4 89.8 72.4 86.4 L72.5 83.6 C73.6 87 75.6 88.2 77.6 87.6 C79.8 86.8 80.6 84 80.8 80.6 C81.6 70 82.2 56 82 44"
+ ` C81.8 32 79.2 20 75.5 10 ${WRIST_RIGHT_END}`,
shadow: "M64.6 -12 L65 1 C70 6 78 14 80.4 36 C81 50 80.6 66 79.6 84 L96 84 L96 -12 Z M40 84 C48 92 66 97 82 84 L82 104 L40 104 Z",
lines: "M51 83 C51 74 51.2 66 51.6 58 M62.3 85.6 C62.3 76 62.2 67 62 58 M72.5 83.6 C72.8 75 73 66 73.2 57",
over: {
body: "M39.5 25 C35 31 33.6 40 35.4 46 C36.8 50.4 41 50 41.6 46 C42.2 41 42 34 41.8 28 Z",
body: `${WRIST_CAP}`
+ " C75 8 80 18 81.5 30 C82.8 41 82.4 55 80.5 67 C79.5 73 76.8 76 73.5 75.5 C71.5 75.2 70.2 73.5 69.8 71"
+ " C69.2 76.5 67.2 81.5 63.2 82 C59.8 82.4 58 80 57.6 76.5"
+ " C57 81.5 54.6 85 50.6 85 C46.8 85 44.8 81.5 44.6 76.5"
+ " C43.8 79.8 41.4 81.8 38.2 81.2 C34.8 80.5 33 76.5 33.6 69.5 C34.5 58 36.2 46.5 38 38"
+ " C35.5 42.5 33 46.5 30 48.5 C26.8 50.5 23.2 49 22.6 45 C22 40 24.8 32.5 29.5 25.5"
+ " C34.5 18 41.8 11 45.2 4 C46 2.5 46.5 1.2 46.5 0 Z",
shadow: "M65 -10 C68 5 74.5 16 77 30 C78.5 43 78 58 75.5 71 C72.5 79 61 84 44 83 L44 92 L90 92 L90 -10 Z",
lines: "M38 38 C39.8 32.5 40.6 27 40 21 M44.6 76.5 C45 69.5 45.8 63 46.8 57.5 M57.6 76.5 C58 69.5 58.4 63 59 57.5 M69.8 71 C70.2 65 70.6 59.5 71 55",
wrist: [60, 0], wristDeg: 0, upright: false,
},
overNails: [[37.4, 44.6, 2.4, 3.2, 6]],
// Mão pensando (apoiada no queixo): punho macio sob o queixo com o indicador estendido na bochecha/queixo
// e os outros 3 dedos dobrados em gomos arredondados (sem aspecto de garfo ou bloco).
think: {
body: `${WRIST_CAP}`
+ " C75.5 8 81.5 18 83.2 30 C84.5 40 84 50 81 57 C78.5 62.5 73.8 64.5 69.5 62.5"
+ " C67.8 67.2 63 69.5 58 68.2 C55.2 67.5 53.2 65.5 52.2 63"
+ " C50.5 66.5 47.8 68.2 44.8 67.5 C44.5 75 44 83.5 43 90"
+ " C42 96.2 38.2 99.5 33.8 98.8 C29.4 98 26.8 93.8 27.6 87"
+ " C29 75.5 31.2 61 33.5 48 C29.5 50.5 25 51.5 21.5 49.5 C17.8 47.5 16.5 42.5 18.8 37.5"
+ " C21.5 31.5 28 25.5 34.5 19.5 C40.5 14 44.8 7 46.5 0 Z",
shadow: "M65 -10 C68 5 75.5 16 78 30 C80 41 79 50 75 57 C69 63.5 57 66.5 43 65 L43 74 L91 74 L91 -10 Z"
+ " M38 56 C39.5 68 39.5 82 38.5 99 L44.5 99 L45 56 Z",
lines: "M33.5 48 C37.5 43 41 37 42.5 31 M45 66.5 C45.8 59 47 52 48.8 46.5 M58 68.2 C58.8 60.5 59.8 53.5 61.5 47.5 M69.5 62.5 C70.2 56 71 50 72.2 45",
wrist: [60, 0], wristDeg: 0, upright: false,
},
// Mão de braços cruzados apoiada no bíceps oposto (como em referencia/recortes/bracos-cruzados.png):
// 3 dedos roliços e macios pousados diagonalmente sobre o braço.
crossed: {
body: `${WRIST_CAP}`
+ " C74.5 8 79 18 80 29 C81 40 79.5 52 75.8 61.5 C73.2 68 68.5 71 63.8 69.5"
+ " C61.4 75.8 56.2 79.2 50.5 77.6 C47 76.6 44.6 73.6 43.8 69.5"
+ " C41.2 74 36.2 76 31.2 73.8 C26.4 71.6 24.4 66 26.8 59.2"
+ " C30 50 34.8 38.5 39 27.5 C42.2 19 45.4 9.5 46.5 0 Z",
shadow: "M64 -10 C67 5 72.5 16 74 30 C75 42 73.5 53 70 62 C65.5 70 52 75 33 72 L33 82 L88 82 L88 -10 Z",
lines: "M43.8 69.5 C46.5 59.5 49.8 50 53.2 42 M63.8 69.5 C65.8 60 67.8 51 70.2 43.5",
wrist: [60, 0], wristDeg: 0, upright: false,
},
};
@@ -191,31 +251,29 @@ export const TWO_HANDED: IconId[] = ["book", "tablet"];
/**
* Como cada objeto entra no punho (`grip`): ponto do cabo no quadro 100×100 do ícone e o giro que deixa o cabo em pé
* (cabeça do martelo, ponta do ramo e da régua para cima). Sem entrada: pelo meio, sem girar.
* (cabeça do martelo, ponta do ramo e da régua para cima) com sobra visível do cabo abaixo da mão.
*/
export const GRIP: Partial<Record<IconId, { x: number; y: number; rot: number }>> = {
hammer: { x: 50, y: 80, rot: 20 },
olive: { x: 26, y: 80, rot: -43 },
ruler: { x: 14, y: 58, rot: -78 },
phone: { x: 50, y: 74, rot: 0 },
hammer: { x: 50, y: 68, rot: 20 },
olive: { x: 36, y: 68, rot: -42 },
ruler: { x: 32, y: 50, rot: -78 },
phone: { x: 50, y: 62, rot: -6 },
fuel: { x: 50, y: 30, rot: 0 },
bulb: { x: 50, y: 82, rot: 0 },
bulb: { x: 50, y: 74, rot: 0 },
};
/**
* Posição da forma: espelho (`mirror`), giro em graus e escala, a partir do pulso na tela, do ângulo do antebraço e do
* lado do braço. Formas alinhadas giram com o antebraço; as "em pé" só inclinam até ±30° para acompanhá-lo.
* lado do braço. Formas alinhadas giram com o antebraço; as "em pé" acompanham o ângulo para o qual foram desenhadas.
*/
export function handPlacement(shape: HandShape, x: number, y: number, foreDeg: number, s: number, k: number) {
const def = SHAPES[shape];
let mirror: number;
let rot: number;
if (def.upright) {
// Desenhada para o braço da direita; o pulso acompanha o eixo do antebraço (gira em torno do centro do pulso).
mirror = s >= 0 ? 1 : -1;
rot = foreDeg - def.wristDeg * mirror;
} else {
// Polegar do lado do corpo; com o braço erguido o eixo local vira e o espelho inverte junto.
const up = Math.cos((foreDeg * Math.PI) / 180) >= 0;
mirror = up ? s : -s;
rot = foreDeg;
@@ -251,14 +309,14 @@ function mixHex(a: string, b: string, t: number): string {
}
function coolHex(hex: string, k: number): string {
const n = parseInt(hex.slice(1), 16);
const r = ((n >> 16) & 255) * k * 0.94, g = ((n >> 8) & 255) * k * 0.97, b = (n & 255) * k + 10;
const r = ((n >> 16) & 255) * k * 0.96, g = ((n >> 8) & 255) * k * 0.96, b = (n & 255) * k + 6;
const c = (v: number) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, "0");
return `#${c(r)}${c(g)}${c(b)}`;
}
/**
* Desenha a forma de mão no lugar. `layer`: "back" = o que fica atrás do objeto, "front" = o que fica na frente,
* "all" = tudo. `light` = lado da sombra na tela (1 = direita). Sem contorno: a borda é o tom escuro da pele.
* "all" = tudo. `light` = lado da sombra na tela (1 = direita).
*/
export function HandArt({ shape, x, y, foreDeg, s, k, skin, light = 1, layer = "all", uid }: {
shape: HandShape; x: number; y: number; foreDeg: number; s: number; k: number; skin: string; light?: number;
@@ -266,38 +324,69 @@ export function HandArt({ shape, x, y, foreDeg, s, k, skin, light = 1, layer = "
}) {
const p = handPlacement(shape, x, y, foreDeg, s, k);
const def = p.def;
// A sombra foi desenhada à direita; se, depois de espelhar e girar, a direita do desenho não cai do lado da sombra
// pedido, a sombra vira para o outro lado (sempre recortada pela silhueta).
const rightOnScreen = p.mirror * Math.cos((p.rot * Math.PI) / 180);
const flipShadow = Math.sign(rightOnScreen || 1) !== Math.sign(light || 1);
const shadowT = flipShadow ? "translate(120 0) scale(-1 1)" : undefined;
const dark = shadeHex(skin, 0.62);
const shadow = coolHex(skin, 0.8);
const lineProps = { stroke: dark, strokeWidth: 1.7, strokeLinecap: "round" as const, strokeLinejoin: "round" as const, fill: "none", opacity: 0.55 };
const shadowT = flipShadow && !def.upright ? "translate(120 0) scale(-1 1)" : undefined;
const creaseColor = shadeHex(skin, 0.76);
const shadowFill = coolHex(skin, 0.86);
const skinLite = mixHex(skin, "#fff6ea", 0.06);
const gradId = `hg${uid}${layer}`;
const lineProps = {
stroke: creaseColor,
strokeWidth: 3.1,
strokeLinecap: "round" as const,
strokeLinejoin: "round" as const,
fill: "none",
opacity: 0.9,
};
const nail = ([cx, cy, rx, ry, a]: [number, number, number, number, number], i: number) => (
<ellipse key={i} cx={cx} cy={cy} rx={rx} ry={ry} transform={`rotate(${a} ${cx} ${cy})`} fill={mixHex(skin, "#f7cfc6", 0.55)} stroke={shadeHex(skin, 0.68)} strokeWidth={0.9} />
<ellipse
key={i}
cx={cx}
cy={cy}
rx={rx}
ry={ry}
transform={`rotate(${a} ${cx} ${cy})`}
fill={mixHex(skin, "#fae5de", 0.38)}
opacity={0.8}
/>
);
const bodyLayer = def.bodyBehind ? "back" : def.hold ? "front" : "all";
const showBody = layer === "all" || layer === bodyLayer || (bodyLayer === "all" && layer === "front");
const showOver = layer !== "back";
return (
<g transform={p.transform}>
<defs>
<linearGradient id={gradId} x1="15%" y1="10%" x2="85%" y2="90%">
<stop offset="0%" stopColor={skinLite} />
<stop offset="100%" stopColor={skin} />
</linearGradient>
<clipPath id={`hb${uid}${layer}`}><path d={def.body} /></clipPath>
{def.over && <clipPath id={`ho${uid}${layer}`}><path d={def.over.body} /></clipPath>}
</defs>
{showBody && <>
<path d={def.body} fill={skin} />
<g clipPath={`url(#hb${uid}${layer})`}><path d={def.shadow} fill={shadow} transform={shadowT} /></g>
<path d={def.lines} {...lineProps} />
{showBody && (
<>
<path d={def.body} fill={`url(#${gradId})`} />
<g clipPath={`url(#hb${uid}${layer})`}>
<path d={def.shadow} fill={shadowFill} transform={shadowT} opacity={0.88} />
</g>
{def.lines && <path d={def.lines} {...lineProps} />}
{(def.nails ?? []).map(nail)}
</>}
{showOver && def.over && <>
<path d={def.over.body} fill={shadeHex(skin, 1.03)} />
{def.over.shadow && <g clipPath={`url(#ho${uid}${layer})`}><path d={def.over.shadow} fill={shadow} /></g>}
</>
)}
{showOver && def.over && (
<>
<path d={def.over.body} fill={`url(#${gradId})`} />
<g clipPath={`url(#ho${uid}${layer})`}>
{def.over.shadow && <path d={def.over.shadow} fill={shadowFill} opacity={0.88} />}
</g>
{def.over.lines && <path d={def.over.lines} {...lineProps} />}
{(def.overNails ?? []).map(nail)}
</>}
</>
)}
</g>
);
}
+37 -15
View File
@@ -72,31 +72,53 @@ const DRAW: Record<IconId, React.ReactNode> = {
</>),
// Itens de mão e objetos de história antiga (também servem como objeto solto na cena).
olive: (<>
<path d="M20 86 Q46 60 86 16" stroke="#6b4a2a" strokeWidth={5} fill="none" strokeLinecap="round" />
{[[34, 66, -40], [44, 56, 30], [54, 46, -40], [64, 36, 30], [74, 26, -40], [28, 76, 30]].map(([x, y, r], i) => (
<ellipse key={i} cx={x} cy={y} rx={13} ry={5.5} fill={i % 2 ? "#7fa24a" : "#5f8a3a"} transform={`rotate(${r} ${x} ${y})`} />
<path d="M14 94 Q44 62 86 14" stroke="#3d2814" strokeWidth={8.5} fill="none" strokeLinecap="round" />
<path d="M14 94 Q44 62 86 14" stroke="#7d5632" strokeWidth={5.5} fill="none" strokeLinecap="round" />
{[[38, 62, -38], [48, 52, 28], [58, 42, -38], [68, 32, 28], [78, 22, -38], [84, 15, -12]].map(([x, y, r], i) => (
<g key={i} transform={`rotate(${r} ${x} ${y})`}>
<ellipse cx={x} cy={y} rx={13.5} ry={6} fill={i % 2 ? "#557d32" : "#446827"} />
<ellipse cx={x} cy={y - 1} rx={12} ry={4.2} fill={i % 2 ? "#84ab4c" : "#6c943c"} />
<path d={`M${x - 9} ${y} L${x + 9} ${y}`} stroke="#9ec462" strokeWidth={1.2} strokeLinecap="round" opacity={0.7} />
</g>
))}
<circle cx={50} cy={58} r={4} fill="#3d3a5a" /><circle cx={70} cy={38} r={4} fill="#3d3a5a" />
<circle cx={54} cy={54} r={4.5} fill="#2e2b4a" /><circle cx={52.5} cy={52.5} r={1.5} fill="#76729e" />
<circle cx={72} cy={35} r={4.5} fill="#2e2b4a" /><circle cx={70.5} cy={33.5} r={1.5} fill="#76729e" />
</>),
hammer: (<>
<rect x={44} y={34} width={12} height={60} rx={5} fill="#8a5a32" transform="rotate(-20 50 64)" />
<rect x={22} y={14} width={50} height={22} rx={4} fill="#8c929e" transform="rotate(-20 47 25)" />
<rect x={22} y={14} width={12} height={22} rx={3} fill="#6c717c" transform="rotate(-20 47 25)" />
<g transform="rotate(-20 50 64)">
<rect x={42.5} y={28} width={15} height={68} rx={6} fill="#5c381c" />
<rect x={44} y={29} width={12} height={66} rx={5} fill="#9c6638" />
<rect x={45.5} y={30} width={4.5} height={64} rx={2} fill="#b87e4a" opacity={0.75} />
<rect x={42} y={32} width={16} height={6} rx={2} fill="#4a2e16" />
</g>
<g transform="rotate(-20 47 25)">
<rect x={18} y={11} width={58} height={25} rx={5} fill="#4d525e" />
<rect x={19} y={12} width={56} height={22} rx={4} fill="#8f96a3" />
<rect x={21} y={14} width={52} height={8} rx={3} fill="#b4bac6" opacity={0.7} />
<rect x={18} y={11} width={14} height={25} rx={4} fill="#686e7a" />
</g>
</>),
tablet: (<>
<path d="M18 10 Q50 4 82 10 L86 88 Q50 96 14 88 Z" fill="#b8916a" />
{Array.from({ length: 7 }, (_, i) => <path key={i} d={`M24 ${22 + i * 10} L76 ${22 + i * 10}`} stroke="#8a6646" strokeWidth={2.5} strokeDasharray="5 3 2 3" />)}
<path d="M18 10 Q50 4 82 10 L86 88 Q50 96 14 88 Z" fill="#8f6c4a" />
<path d="M20 12 Q50 6 80 12 L84 86 Q50 93 16 86 Z" fill="#b8916a" />
{Array.from({ length: 7 }, (_, i) => <path key={i} d={`M24 ${22 + i * 10} L76 ${22 + i * 10}`} stroke="#785638" strokeWidth={2.5} strokeDasharray="5 3 2 3" />)}
<path d="M70 70 L86 60 L86 88 L64 92 Z" fill="#000" opacity={0.18} />
</>),
book: (<>
<path d="M8 24 Q30 16 50 26 Q70 16 92 24 L92 82 Q70 74 50 84 Q30 74 8 82 Z" fill="#f2e8d0" />
<path d="M50 26 L50 84" stroke="#b9a882" strokeWidth={3} />
{[0, 1, 2, 3].map((i) => <g key={i}><path d={`M16 ${36 + i * 11} L42 ${38 + i * 11}`} stroke="#9a8a6a" strokeWidth={2.5} /><path d={`M58 ${38 + i * 11} L84 ${36 + i * 11}`} stroke="#9a8a6a" strokeWidth={2.5} /></g>)}
<path d="M8 82 Q30 74 50 84 Q70 74 92 82 L92 88 Q70 80 50 90 Q30 80 8 88 Z" fill="#7a3a2a" />
<path d="M6 26 Q28 18 50 28 Q72 18 94 26 L94 86 Q72 78 50 88 Q28 78 6 86 Z" fill="#6b3022" />
<path d="M8 22 Q30 14 50 24 Q70 14 92 22 L92 80 Q70 72 50 82 Q30 72 8 80 Z" fill="#dfd2b5" />
<path d="M9 20 Q30 12 50 22 Q70 12 91 20 L91 77 Q70 69 50 79 Q30 69 9 77 Z" fill="#f5ecd6" />
<path d="M44 20 Q47 21 50 22 Q53 21 56 20 L56 78 Q53 78.5 50 79 Q47 78.5 44 78 Z" fill="#e2d5b8" />
<path d="M50 22 L50 79" stroke="#b9a882" strokeWidth={2.5} />
{[0, 1, 2, 3].map((i) => <g key={i}><path d={`M16 ${32 + i * 10.5} Q29 ${29 + i * 10.5} 43 ${34 + i * 10.5}`} stroke="#9a8a6a" strokeWidth={2.4} fill="none" strokeLinecap="round" /><path d={`M57 ${34 + i * 10.5} Q71 ${29 + i * 10.5} 84 ${32 + i * 10.5}`} stroke="#9a8a6a" strokeWidth={2.4} fill="none" strokeLinecap="round" /></g>)}
</>),
ruler: (<>
<rect x={6} y={38} width={88} height={24} rx={3} fill="#e6c27a" transform="rotate(-12 50 50)" />
{Array.from({ length: 10 }, (_, i) => <rect key={i} x={12 + i * 8.4} y={38} width={2.4} height={i % 2 ? 7 : 12} fill="#6b4a2a" transform="rotate(-12 50 50)" />)}
<g transform="rotate(-12 50 50)">
<rect x={4} y={36} width={92} height={26} rx={4} fill="#8c6230" />
<rect x={6} y={37} width={88} height={23} rx={3} fill="#e8c374" />
<rect x={8} y={53} width={84} height={6} rx={2} fill="#cfa656" />
{Array.from({ length: 11 }, (_, i) => <rect key={i} x={11 + i * 7.6} y={37} width={2.2} height={i % 2 ? 7 : 12} rx={0.8} fill="#5c3d1b" />)}
</g>
</>),
};
+7 -4
View File
@@ -47,12 +47,15 @@ export function armGeometry(b: BodyParams, s: 1 | -1, w = 1) {
export function armLayer(b: BodyParams, s: 1 | -1, opts: { holds?: boolean; w?: number } = {}): ArmLayer {
const w = opts.w ?? 1;
const g = armGeometry(b, s, w);
const l = s > 0 ? b.armR : b.armL;
const half = ARM.torsoHalf * w;
// Altura do pescoço/rosto: acima do topo do tronco (+ folga da gola), dentro da largura da cabeça.
const atFace = (p: Point) => p.y < g.torsoTop + 12 && Math.abs(p.x - 100) < 66;
if (atFace(g.hand)) return "face";
// Altura do pescoço/rosto: acima do topo do tronco (+ folga da gola), dentro da largura da cabeça, ou braço dobrado ao queixo/boca.
const atFace = (p: Point) => p.y < g.torsoTop + 20 && Math.abs(p.x - 100) < 60;
if (atFace(g.hand) || atFace(g.wrist) || (l.raise < 20 && l.bend > 138)) return "face";
if (opts.holds) return "front";
const chest = { x0: 100 - half + 16, x1: 100 + half - 16, y0: g.torsoTop + 6, y1: g.hipY + 10 };
// Cotovelo bem dobrado para dentro com o braço baixo (segurar, joinha, mão na cintura, braços cruzados): antebraço na frente.
if (l.raise < 90 && l.bend > 85) return "front";
const chest = { x0: 100 - half + 14, x1: 100 + half - 14, y0: g.torsoTop + 4, y1: g.hipY + 12 };
const inChest = (p: Point) => p.x > chest.x0 && p.x < chest.x1 && p.y > chest.y0 && p.y < chest.y1;
// Amostra o antebraço (cotovelo → mão): basta um trecho na frente do peito.
for (let i = 0; i <= 8; i++) {
+9 -9
View File
@@ -110,26 +110,26 @@ export const EXPRESSION_PRESETS = {
/** Poses prontas = atalhos de ângulos (ajustáveis por cima com `body`). */
export const POSE_PRESETS = {
stand: {},
point: { armR: { raise: 92, bend: 0 } },
point: { armR: { raise: 46, bend: -128 } },
wave: { armR: { raise: 140, bend: -25 } },
hold: { armR: { raise: 28, bend: 75 } },
hold: { armR: { raise: 34, bend: 106 } },
arms_up: { arms: { raise: 158, bend: -10 } },
celebrate: { arms: { raise: 150, bend: -30 }, headNod: -0.4 },
celebrate: { arms: { raise: 146, bend: -26 }, headNod: -0.35 },
shrug: { arms: { raise: 38, bend: 100 }, headTilt: 7 },
think: { armR: { raise: -19, bend: 141 }, headTilt: -6 },
think: { armR: { raise: -24, bend: 138 }, headTilt: -5 },
hands_on_hips: { arms: { raise: 42, bend: 105 } },
cross_arms: { arms: { raise: 22, bend: 128 } },
cross_arms: { arms: { raise: 24, bend: 128 } },
facepalm: { armR: { raise: 125, bend: -103 }, headNod: 0.5, headTilt: 8 },
cover_mouth: { armR: { raise: -60, bend: 119 } },
cover_mouth: { armR: { raise: -34, bend: 130 } },
defend: { arms: { raise: 62, bend: 118 }, lean: -4 },
reach: { armR: { raise: 70, bend: -10 }, lean: 6 },
reach: { armR: { raise: 68, bend: -15 }, lean: 6 },
sit: { crouch: 1, arms: { raise: 14, bend: 40 } },
kneel: { crouch: 0.6, arms: { raise: 10, bend: 20 } },
lean_in: { lean: 8, headTilt: 6 },
// Duas mãos segurando um objeto largo (livro, tábua) pelas bordas, na frente do peito.
hold_both: { arms: { raise: 51, bend: 99 } },
hold_both: { arms: { raise: 42, bend: 104 } },
// Joinha: cotovelo dobrado, mão na altura do peito/ombro (a forma da mão vem do desenho: `thumbs_up`).
thumbs_up: { armR: { raise: 17, bend: 149 } },
thumbs_up: { armR: { raise: 22, bend: 148 } },
} satisfies Record<string, BodyPatch>;
export type ExpressionName = keyof typeof EXPRESSION_PRESETS;