← Casa completaObjeto 3Dfogon/cuna
Cuna
Arrastrá para girarlo// «Cuna» · gpt-6-sol (medium)
// A baby crib: a rectangular white wooden crib with vertical slats all around, a soft pastel yellow mattress inside, a small pink blanket and a teddy bear lying on it. Above it, a hanging mobile on a curved arm with little colorful stars and moons.
const white = "#f8f5ec";
const light = "#ffffff";
const shadow = "#deded7";
const groove = "#c8cbc8";
const yellow = "#f7e7a2";
const pink = "#f3aebb";
// Four sturdy corner posts, with feet touching the floor.
for (const x of [7, 40]) for (const y of [11, 37]) {
box(x - 1, y - 1, 0, x + 1, y + 1, 25, white);
box(x - 1, y + 1, 0, x + 1, y + 1, 23, shadow);
box(x - 2, y - 2, 25, x + 2, y + 2, 26, light);
box(x - 1, y - 1, 27, x + 1, y + 1, 27, "#f4e8cf");
}
// Solid base, recessed beneath the mattress.
box(8, 12, 6, 39, 36, 9, "#eceae0");
box(9, 13, 9, 38, 35, 10, groove);
box(10, 14, 11, 37, 34, 12, "#e8d88f");
box(10, 14, 13, 37, 34, 14, yellow);
box(11, 15, 15, 36, 33, 15, "#fff0b7");
for (let i = 0; i < 95; i++) {
const x = 11 + Math.floor(rand() * 26);
const y = 15 + Math.floor(rand() * 19);
set(x, y, 15, rand() < 0.5 ? "#f9eaae" : "#fff2c1");
}
// A pink blanket, folded back near the teddy bear.
box(11, 15, 16, 24, 31, 16, pink);
box(11, 15, 17, 24, 18, 17, "#ffd2cc");
box(12, 19, 17, 23, 28, 17, "#f8bdbd");
for (let x = 12; x <= 23; x += 3) {
set(x, 16, 18, "#fff0dc");
set(x, 30, 17, "#e78fa5");
}
for (let y = 20; y <= 29; y += 3) set(23, y, 18, "#ffe0d7");
// Teddy bear lying lengthwise on the bed, head toward the viewer.
ellipsoid(30, 27, 17, 3, 5, 2, "#bd865b");
ellipsoid(30, 27, 18, 2, 4, 1, "#dba675");
for (const x of [27, 33]) {
ellipsoid(x, 27, 17, 1, 3, 1, "#ac7552");
sphere(x, 30, 17, 1, "#d29a6a");
}
for (const x of [29, 31]) ellipsoid(x, 32, 16, 1, 2, 1, "#ad7651");
sphere(30, 21, 18, 3, "#ce9668");
sphere(28, 19, 20, 1, "#bd865b");
sphere(32, 19, 20, 1, "#bd865b");
set(28, 18, 20, "#e9b98d");
set(32, 18, 20, "#e9b98d");
ellipsoid(30, 18, 17, 2, 1, 1, "#efcfaa");
set(29, 18, 19, "#382c2b");
set(31, 18, 19, "#382c2b");
set(30, 17, 18, "#5b3a36");
set(30, 17, 17, "#8b574a");
// Low apron rails, slender slats, and broad handrails all around.
for (const y of [11, 37]) {
box(9, y, 7, 38, y + 1, 9, shadow);
for (let x = 12; x <= 36; x += 4) {
box(x, y, 10, x + 1, y + 1, y === 11 ? 21 : 23, white);
box(x, y, 11, x, y, y === 11 ? 20 : 22, light);
}
const top = y === 11 ? 22 : 24;
box(8, y - 1, top, 39, y + 2, top + 2, white);
box(9, y - 1, top + 2, 38, y + 1, top + 2, light);
}
for (const x of [7, 40]) {
box(x, 13, 7, x + 1, 35, 9, shadow);
for (let y = 16; y <= 33; y += 4) {
box(x, y, 10, x + 1, y + 1, 22, white);
}
box(x - 1, 13, 23, x + 2, 35, 25, white);
box(x - 1, 13, 25, x + 1, 35, 25, light);
}
// Fixed curved arm rises from the back-right post.
box(40, 35, 27, 42, 37, 35, white);
line(41, 36, 35, 39, 34, 39, 1, shadow);
line(39, 34, 39, 35, 31, 42, 1, white);
line(35, 31, 42, 27, 25, 42, 1, white);
sphere(26, 25, 42, 2, "#f4e8cf");
// The entire hanging mobile turns at the tip of the arm.
part("mobile", [26, 25, 42]);
cylinder(26, 25, 39, 2, 3, "#e7b9a5");
line(17, 25, 39, 35, 25, 39, 1, "#eedfc6");
line(26, 16, 39, 26, 34, 39, 1, "#eedfc6");
sphere(26, 25, 39, 2, "#fff6df");
const ornaments = [
[17, 25, 33, "star", "#f2b76f"],
[35, 25, 31, "moon", "#a6d9ce"],
[26, 16, 32, "star", "#a9cceb"],
[26, 34, 34, "moon", "#edabc0"]
];
for (const [cx, cy, cz, shape, color] of ornaments) {
line(cx, cy, cz + 3, cx, cy, 38, 0, "#c6b7a6");
const pixels = shape === "star"
? [[0,3],[-1,1],[0,1],[1,1],[-3,0],[-2,0],[-1,0],[0,0],[1,0],[2,0],[3,0],
[-2,-1],[-1,-1],[0,-1],[1,-1],[2,-1],[-2,-2],[-1,-2],[1,-2],[2,-2]]
: [[-1,3],[0,3],[1,3],[-2,2],[-1,2],[-2,1],[-1,1],[-3,0],[-2,0],
[-3,-1],[-2,-1],[-2,-2],[-1,-2],[-1,-3],[0,-3],[1,-3]];
for (const [dx, dz] of pixels) {
set(cx + dx, cy, cz + dz, color);
set(cx + dx, cy + 1, cz + dz, color);
}
set(cx - 1, cy - 1, cz + 1, "#fff5db");
}
animate("mobile", { type: "spin", axis: "z", speed: 0.8 });
part("body", [24, 24, 0]);import { draw } from "./assets/voxel";
import { cuna } from "./assets/cuna";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, cuna, 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 cuna
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["cuna"] })
# Queda en client/assets/cuna.ts
# https://fogon.page/object/cuna