← CiudadObjeto 3Dfogon/hamaca
Hamaca
Arrastrá para girarlo// «Hamaca» · gpt-6-sol (medium)
// A playground swing set: a sturdy A-frame of red metal tubes with a horizontal top bar, two swings hanging from it on chains, each with a flat yellow seat. Wide along x, with the swings facing -y.
// Concrete pads beneath the four feet.
const pad = "#b8b9b3", padTop = "#d6d5c9", padEdge = "#92958f";
for (const x of [6, 41]) {
for (const y of [11, 37]) {
box(x - 4, y - 3, 0, x + 4, y + 3, 0, padEdge);
box(x - 3, y - 2, 0, x + 3, y + 2, 0, padTop);
for (let i = 0; i < 9; i++) {
const px = x - 3 + Math.floor(rand() * 7);
const py = y - 2 + Math.floor(rand() * 5);
set(px, py, 0, pad);
}
}
}
const darkRed = "#a72d35";
const red = "#e24b49";
const brightRed = "#fa7770";
function redTube(x0, y0, z0, x1, y1, z1, r) {
line(x0, y0, z0, x1, y1, z1, r + 0.45, darkRed);
line(x0, y0, z0, x1, y1, z1, r, red);
}
// Four splayed legs make two sturdy A-frames.
for (const x of [6, 41]) {
for (const footY of [11, 37]) {
redTube(x, footY, 2, x, 24, 36, 1.15);
// Foot plate, with exposed fastening bolts.
box(x - 2, footY - 2, 1, x + 2, footY + 2, 2, darkRed);
box(x - 1, footY - 1, 2, x + 1, footY + 1, 2, red);
set(x - 2, footY - 2, 2, "#f2c76b");
set(x + 2, footY + 2, 2, "#f2c76b");
}
// Crosspiece completes the readable A silhouette.
redTube(x, 16, 13, x, 32, 13, 0.9);
set(x, 23, 14, brightRed);
set(x, 24, 14, "#ffd371");
set(x, 25, 14, brightRed);
}
// Long horizontal top rail, shaded like painted tubular steel.
line(4, 24, 36, 43, 24, 36, 1.85, darkRed);
line(4, 24, 36, 43, 24, 36, 1.3, red);
line(5, 23, 37, 42, 23, 37, 0, brightRed);
for (const x of [4, 6, 24, 41, 43]) {
box(x, 23, 35, x, 25, 37, darkRed);
set(x, 23, 37, "#ffb16c");
}
// Fixed hanging brackets and dark pivot pins.
for (const cx of [15, 32]) {
for (const chainX of [cx - 5, cx + 5]) {
box(chainX - 1, 22, 34, chainX + 1, 25, 35, "#73383a");
box(chainX, 22, 33, chainX, 24, 34, "#444e50");
set(chainX, 21, 34, "#f4bf61");
}
}
// Each complete swing rotates around its own point on the top bar.
function makeSwing(name, cx, speed) {
part(name, [cx, 24, 35]);
const steelDark = "#526467";
const steelLight = "#abbdbc";
for (const chainX of [cx - 5, cx + 5]) {
line(chainX, 24, 11, chainX, 24, 33, 0, steelDark);
// Alternating bright links give the chains texture at small scale.
for (let z = 12; z <= 32; z += 3) {
set(chainX, 23, z, steelLight);
set(chainX, 24, z + 1, "#82999b");
}
}
// Chunky, flat yellow seat with a warm orange underside.
box(cx - 6, 21, 9, cx + 6, 27, 9, "#b87027");
box(cx - 6, 21, 10, cx + 6, 27, 10, "#f4b935");
box(cx - 5, 22, 10, cx + 5, 25, 10, "#ffe272");
box(cx - 6, 21, 10, cx + 6, 21, 10, "#ffd053");
for (const chainX of [cx - 5, cx + 5]) {
box(chainX - 1, 23, 10, chainX + 1, 25, 11, "#d68b2e");
set(chainX, 23, 11, "#ffe88d");
}
animate(name, { type: "swing", axis: "x", speed, amplitude: 0.5 });
}
makeSwing("left swing", 15, 2);
makeSwing("right swing", 32, -2);
part("body", [24, 24, 0]);import { draw } from "./assets/voxel";
import { hamaca } from "./assets/hamaca";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, hamaca, 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 hamaca
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["hamaca"] })
# Queda en client/assets/hamaca.ts
# https://fogon.page/object/hamaca