← BásicoObjeto 3Dfogon/lampara-de-escritorio
Lámpara de escritorio
Arrastrá para girarlo// «Lámpara de escritorio» · gpt-6-sol (medium)
// Desk lamp («Lámpara de escritorio»).
const tealDark = "#075760";
const teal = "#087d83";
const tealMid = "#12969a";
const tealLight = "#37b2ae";
const cream = "#e9d9aa";
const gold = "#c59650";
function disk(cx, cy, z, rx, ry, inner, edge) {
for (let x = Math.ceil(cx - rx); x <= cx + rx; x++) {
for (let y = Math.ceil(cy - ry); y <= cy + ry; y++) {
const d = Math.sqrt(((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2);
if (d > 1) continue;
let color = d > 0.87 ? edge : inner;
if (d < 0.87 && rand() < 0.075) color = "#2ca5a5";
set(x, y, z, color);
}
}
}
// Low, broad circular foot with a dark stepped edge.
disk(24, 24, 0, 16, 14, "#173e45", "#122f36");
disk(24, 24, 1, 17, 15, "#075d65", "#153f47");
disk(24, 24, 2, 17, 15, teal, tealDark);
disk(24, 24, 3, 16, 14, tealMid, tealDark);
disk(24, 24, 4, 15, 13, "#18a3a4", "#08757a");
disk(24, 24, 5, 13, 11, "#20a9a8", tealMid);
// Small brass-edged switch on the near side of the foot.
box(25, 11, 5, 30, 15, 5, "#745d3b");
box(26, 12, 6, 29, 14, 6, gold);
box(26, 12, 7, 28, 14, 7, "#d9ded0");
set(27, 12, 8, "#f1e8ce");
// Heavy socket and the lower, angled support.
box(25, 24, 5, 31, 30, 7, tealDark);
box(26, 25, 7, 30, 29, 10, "#096c71");
box(29, 25, 8, 32, 29, 11, "#aa793c");
box(29, 25, 11, 32, 29, 12, tealDark);
line(30, 27, 12, 35, 29, 25, 2, tealDark);
line(29, 26, 13, 34, 28, 25, 1, tealMid);
line(32, 29, 13, 37, 31, 25, 0, "#9db5ad");
line(31, 26, 16, 35, 28, 26, 0, tealLight);
// Brass pivot at the right-hand elbow.
sphere(36, 29, 26, 3, "#735833");
box(35, 26, 24, 39, 30, 28, "#ad7d3d");
box(37, 27, 25, 40, 30, 27, "#c79850");
set(40, 28, 26, "#e0b769");
// Upper arm reaches back to the crown of the shade.
line(35, 29, 27, 23, 24, 39, 2, "#245f65");
line(36, 27, 28, 24, 22, 40, 0, "#b8c9bd");
line(37, 30, 28, 25, 25, 40, 0, tealLight);
for (let i = 1; i <= 5; i++) {
const t = i / 6;
const x = Math.round(35 - 12 * t);
const y = Math.round(29 - 5 * t);
const z = Math.round(27 + 12 * t);
set(x, y - 1, z + 1, "#93aaa3");
}
// Warm, recessed underside of the broad shade.
disk(17, 19, 26, 12, 10, "#d1b780", "#805e39");
disk(17, 19, 27, 14, 11, "#d6bf8d", "#725834");
ellipsoid(17, 19, 25, 4, 3, 2, "#f0dfad");
// Individually stepped ivory scallops around the lower rim.
for (let x = 3; x <= 31; x++) {
for (let y = 8; y <= 30; y++) {
const d = Math.sqrt(((x - 17) / 14) ** 2 + ((y - 19) / 11) ** 2);
if (d < 0.86 || d > 1) continue;
set(x, y, 28, (x + y) % 5 === 0 ? "#a7834d" : cream);
if ((x + 2 * y) % 4 !== 0) {
set(x, y, 27, y < 19 ? "#e9d7a6" : "#bd9b68");
if (y < 19 && (x + y) % 3 === 0) set(x, y, 26, "#d2ae73");
}
}
}
// Layered, tapering turquoise metal shade. Its crown leans toward the arm.
const tiers = [
[29, 17, 19, 14, 11],
[30, 17, 19, 14, 11],
[31, 18, 19, 13, 10],
[32, 18, 20, 12, 10],
[33, 19, 20, 11, 9],
[34, 19, 20, 10, 8],
[35, 20, 21, 9, 7],
[36, 20, 21, 8, 7],
[37, 21, 21, 7, 6],
[38, 21, 22, 6, 5],
[39, 22, 22, 5, 4],
[40, 22, 22, 4, 3]
];
for (const [z, cx, cy, rx, ry] of tiers) {
for (let x = Math.ceil(cx - rx); x <= cx + rx; x++) {
for (let y = Math.ceil(cy - ry); y <= cy + ry; y++) {
const d = Math.sqrt(((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2);
if (d > 1) continue;
let color = tealMid;
if (d > 0.84) color = y < cy ? tealLight : tealDark;
else if (rand() < 0.09) color = tealLight;
if (z === 29 && d > 0.75) color = tealDark;
if ((z === 32 || z === 36) && d > 0.73 && y <= cy + 2)
color = (x + y) % 6 === 0 ? gold : "#e6d5a6";
set(x, y, z, color);
}
}
}
// Stacked cap, dark rim, and little brass finial.
disk(22, 22, 41, 4, 3, "#157d80", tealDark);
box(20, 20, 42, 24, 24, 42, "#174b50");
box(21, 21, 43, 23, 23, 43, gold);
set(22, 22, 44, "#e1b666");
set(23, 21, 43, "#f1ce83");import { draw } from "./assets/voxel";
import { lamparaDeEscritorio } from "./assets/lampara-de-escritorio";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, lamparaDeEscritorio, 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 lampara-de-escritorio
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["lampara-de-escritorio"] })
# Queda en client/assets/lampara-de-escritorio.ts
# https://fogon.page/object/lampara-de-escritorio