← AnimalesObjeto 3Dfogon/caracol
Caracol
Arrastrá para girarlo// «Caracol» · gpt-6-sol (medium)
// A cute cartoon snail, horizontal along y, head at the front (-y): a soft pale green-yellow body sliding along the floor with two eye stalks on its head, and a big spiral shell on its back in orange and brown stripes.
// A low, soft body and broad sliding foot.
function greenEllipsoid(cx, cy, cz, rx, ry, rz) {
for (let x = Math.floor(cx - rx); x <= cx + rx; x++)
for (let y = Math.floor(cy - ry); y <= cy + ry; y++)
for (let z = Math.max(0, Math.floor(cz - rz)); z <= cz + rz; z++) {
const q = ((x-cx)/rx)**2 + ((y-cy)/ry)**2 + ((z-cz)/rz)**2;
if (q > 1) continue;
let color = z < 4 ? "#90ad52" : z < 11 ? "#b9d875" : "#d8ec92";
if (rand() < 0.055) color = z < 7 ? "#a7c764" : "#c6df7e";
set(x, y, z, color);
}
}
greenEllipsoid(24, 23, 4, 17, 19, 5);
greenEllipsoid(24, 18, 10, 13, 14, 9);
greenEllipsoid(24, 12, 15, 11, 10, 10);
// Shell: a solid, rounded orange dome with broad, warm bands.
const spiral = [];
for (let t = 0; t <= 13.5; t += 0.075) {
const r = 0.7 + 0.79 * t;
spiral.push([28 + r * Math.cos(t), 23 + r * 1.25 * Math.sin(t)]);
}
for (let x = 10; x <= 38; x++)
for (let y = 16; y <= 40; y++)
for (let z = 8; z <= 38; z++) {
const dx = (x-24)/14, dy = (y-28)/12, dz = (z-23)/15;
const q = dx*dx + dy*dy + dz*dz;
if (q > 1) continue;
const angle = Math.atan2(dz, dy);
const band = Math.sin(angle * 5 + Math.sqrt(dy*dy+dz*dz) * 2.2);
let color = band > 0.42 ? "#d26f2f" :
band < -0.42 ? "#f5a34a" : "#e98738";
if (z < 14) color = band > 0 ? "#aa562b" : "#c46a30";
else if (z > 29 && band < -0.42) color = "#ffb65b";
if (rand() < 0.035) color = band > 0 ? "#bd612d" : "#ffae53";
// A dark, curling spiral is drawn on both visible sides of the shell.
const sideEdge = 14 * Math.sqrt(Math.max(0, 1-dy*dy-dz*dz));
if (Math.abs(x-24) >= sideEdge-2.1 && sideEdge > 2) {
let nearest = 100;
for (const [sy, sz] of spiral) {
const d = (y-sy)**2 + (z-sz)**2;
if (d < nearest) nearest = d;
}
if (nearest < 1.45) color = "#874126";
else if (nearest < 3.1) color = "#b45a2c";
}
set(x, y, z, color);
}
// Little raised rim where the shell rests on the body.
for (let y = 18; y <= 38; y++) {
const rise = Math.sqrt(Math.max(0, 1-((y-28)/12)**2));
for (const side of [-1, 1]) {
const x = Math.round(24 + side * 13 * rise);
line(x, y, 10, x, y, 12, 0, "#99502b");
}
}
// Rounded face and pale, puffy muzzle.
greenEllipsoid(24, 12, 15, 11, 10, 10);
ellipsoid(20, 5, 13, 4, 2, 3, "#e8f1a7");
ellipsoid(28, 5, 13, 4, 2, 3, "#e8f1a7");
ellipsoid(16, 7, 15, 2, 1, 1, "#e9a28d");
ellipsoid(32, 7, 15, 2, 1, 1, "#e9a28d");
// A small curved smile, facing -y.
set(20, 4, 12, "#698747");
set(21, 3, 11, "#698747");
for (let x = 22; x <= 26; x++) set(x, 3, 10, "#698747");
set(27, 3, 11, "#698747");
set(28, 4, 12, "#698747");
// Independently swaying eye stalks.
function eyeStalk(name, x, lean) {
part(name, [x, 9, 23]);
line(x, 9, 23, x + lean, 8, 31, 1.5, "#bedb79");
ellipsoid(x + lean, 7, 32, 4, 3, 4, "#d8ec92");
ellipsoid(x + lean, 4, 33, 2.5, 1, 2.5, "#fff9e8");
ellipsoid(x + lean, 2, 33, 1.3, 1, 1.6, "#242925");
set(x + lean - 1, 1, 34, "#ffffff");
animate(name, { type: "swing", axis: "x", speed: 2, amplitude: 0.2 });
part("body");
}
eyeStalk("left_eye_stalk", 17, -1);
eyeStalk("right_eye_stalk", 31, 1);import { draw } from "./assets/voxel";
import { caracol } from "./assets/caracol";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, caracol, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: lo que mide en px su lado más largo
// angle: giro sobre el piso, en radianes
// t: segundos; si se mueve, se anima solo con eso# En una terminal, en la carpeta del juego
fogon assets add caracol
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["caracol"] })
# Queda en client/assets/caracol.ts
# https://fogon.page/object/caracol