← AnimalesObjeto 3Dfogon/serpiente
Serpiente
Arrastrá para girarlo// «Serpiente» · gpt-6-sol (medium)
// A cartoon snake coiled on the floor with its head raised and facing front (-y): a thick round green body with a yellow belly and a zigzag pattern of darker green diamonds, a rounded head with big friendly eyes and a forked red tongue.
const green = "#43b84b";
const light = "#62d65d";
const dark = "#2f9140";
const diamond = "#247a39";
const belly = "#f6d765";
const bellyShade = "#e8bd4e";
// A thick spiral coil resting on the floor, with a tapered tail at the right.
for (let i = 0; i <= 14; i++) {
const t = i / 14;
sphere(41 - 3 * t, 31 - 6 * t, 3.1 + 1.9 * t, 1.2 + 3.6 * t, green);
}
function coilPoint(t) {
const a = t * Math.PI * 3.5;
return {
x: 24 + (14 - 7 * t) * Math.cos(a),
y: 25 + (12 - 5 * t) * Math.sin(a),
z: 4 + 3 * t
};
}
for (let i = 0; i <= 195; i++) {
const p = coilPoint(i / 195);
sphere(p.x, p.y, p.z, 4.8, green);
}
// Top-lit greens, a broad yellow underside, and bold diamonds.
const marks = [];
for (let t = 0.075; t < 0.98; t += 0.053) {
const p = coilPoint(t);
const before = coilPoint(Math.max(0, t - 0.002));
const after = coilPoint(Math.min(1, t + 0.002));
const length = Math.hypot(after.x - before.x, after.y - before.y);
marks.push({
...p,
tx: (after.x - before.x) / length,
ty: (after.y - before.y) / length
});
}
forEach((x, y, z, color) => {
if (color !== green) return;
let shade = z >= 8 ? light : z <= 3 ? dark : green;
if (rand() < 0.075) shade = z >= 7 ? green : dark;
if (y <= 12 && x >= 10 && x <= 38 && z >= 3 && z <= 8)
shade = z <= 4 ? bellyShade : belly;
for (const m of marks) {
const dx = x - m.x, dy = y - m.y;
const along = dx * m.tx + dy * m.ty;
const across = -dx * m.ty + dy * m.tx;
if (z >= 7 && Math.abs(along) / 2.55 + Math.abs(across) / 3.05 < 1) {
shade = diamond;
break;
}
}
set(x, y, z, shade);
});
// The raised neck and head sway together from the top of the coil.
part("headAndNeck", [24, 17, 10]);
animate("headAndNeck", {
type: "swing", axis: "y", speed: 2, amplitude: 0.25
});
for (let i = 0; i <= 11; i++) {
const cz = 10 + i * 1.65;
const cy = 17 - (cz - 10) * 0.17;
const r = 4.55;
for (let dx = -5; dx <= 5; dx++)
for (let dy = -5; dy <= 5; dy++)
for (let dz = -5; dz <= 5; dz++) {
if (dx * dx + dy * dy + dz * dz > r * r) continue;
const front = dy <= -2.2 && Math.abs(dx) <= 3;
const c = front ? (dz < -2 ? bellyShade : belly)
: dz > 1 ? light : dz < -2 ? dark : green;
set(24 + dx, cy + dy, cz + dz, c);
}
}
// Oversized rounded head, pale chin, and projecting smiling muzzle.
ellipsoid(24, 14, 31, 8, 7, 7, green);
ellipsoid(24, 14, 33.5, 7.4, 6.4, 4.1, light);
ellipsoid(24, 10.4, 26.7, 5.7, 3.2, 3.3, belly);
ellipsoid(24, 8.8, 28, 6.3, 3.8, 3.3, light);
// Big forward-facing toy eyes.
for (const x of [20, 28]) {
ellipsoid(x, 8.1, 34, 2.45, 1.7, 2.65, "#fffaf0");
sphere(x, 6.35, 33.9, 1.35, "#172d25");
set(x - 0.5, 5.25, 34.6, "#ffffff");
}
// Tiny nostrils and an upward-curving smile.
for (const x of [21, 27]) sphere(x, 5.25, 29.25, 0.65, dark);
line(20, 6.2, 27.2, 22, 5.15, 25.6, 0, "#325a34");
line(22, 5.15, 25.6, 26, 5.15, 25.6, 0, "#325a34");
line(26, 5.15, 25.6, 28, 6.2, 27.2, 0, "#325a34");
// A visible forked red tongue.
line(24, 5.2, 25.2, 24, 3.2, 23.5, 1, "#e83f50");
line(24, 3.2, 23.5, 22, 2, 24.3, 0, "#e83f50");
line(24, 3.2, 23.5, 26, 2, 24.3, 0, "#e83f50");
part("body", [24, 24, 0]);import { draw } from "./assets/voxel";
import { serpiente } from "./assets/serpiente";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, serpiente, 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 serpiente
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["serpiente"] })
# Queda en client/assets/serpiente.ts
# https://fogon.page/object/serpiente