← FantasíaObjeto 3Dfogon/lampara-de-hada
Lámpara de hada
Arrastrá para girarlo// «Lámpara de hada» · gpt-6-sol (medium)
// A fairy lamp: a tall curved dark iron post shaped like a vine with leaves, ending in a hanging glass bulb where a little glowing fairy light shines in pink and yellow.
// Stone foot of the lamp
cylinder(15, 25, 0, 8, 3, "#555b56");
cylinder(15, 25, 3, 6, 2, "#70766b");
cylinder(15, 25, 5, 4, 2, "#414b48");
for (let i = 0; i < 65; i++) {
const x = 8 + Math.floor(rand() * 15);
const y = 18 + Math.floor(rand() * 15);
const z = Math.floor(rand() * 3);
if (get(x, y, z)) set(x, y, z, rand() < 0.7 ? "#809472" : "#343e3e");
}
// Curved, weathered iron vine
const vine = [
[15, 25, 6], [14, 25, 11], [13, 26, 17], [14, 26, 24],
[17, 26, 32], [22, 25, 39], [27, 24, 42], [32, 23, 41],
[35, 23, 38], [34, 23, 36]
];
for (let i = 0; i < vine.length - 1; i++) {
line(...vine[i], ...vine[i + 1], i < 5 ? 2 : 1.5, "#292e35");
}
for (let i = 0; i < vine.length - 1; i++) {
const a = vine[i], b = vine[i + 1];
line(a[0] - 1, a[1] - 1, a[2], b[0] - 1, b[1] - 1, b[2], 0, "#56605a");
}
for (const [x, y, z] of [[14, 25, 12], [14, 26, 23], [19, 25, 35], [28, 24, 42]]) {
sphere(x, y, z, 1.5, "#927c54");
set(x, y - 2, z, "#c0a16d");
}
// Little curls branching off the post
line(14, 26, 18, 10, 27, 21, 0, "#454d47");
line(10, 27, 21, 9, 27, 24, 0, "#454d47");
line(18, 26, 34, 18, 30, 37, 0, "#454d47");
line(18, 30, 37, 21, 31, 38, 0, "#454d47");
function leaf(bx, by, bz, tx, ty, tz, shade) {
line(bx, by, bz, tx, ty, tz, 0, "#384c47");
const mx = Math.round((bx + tx) / 2);
const my = Math.round((by + ty) / 2);
const mz = Math.round((bz + tz) / 2);
ellipsoid(mx, my, mz,
Math.max(2, Math.abs(tx - bx) / 2),
Math.max(1, Math.abs(ty - by) / 2),
Math.max(1, Math.abs(tz - bz) / 2), shade);
line(bx, by - 1, bz, tx, ty - 1, tz, 0, "#91b58d");
set(tx, ty, tz, "#add29d");
}
leaf(14, 26, 15, 6, 25, 18, "#497866");
leaf(14, 26, 21, 21, 28, 24, "#527d6e");
leaf(16, 26, 30, 9, 27, 33, "#477365");
leaf(20, 25, 37, 20, 32, 40, "#5c8973");
leaf(26, 24, 42, 24, 18, 44, "#558676");
leaf(12, 25, 9, 7, 20, 10, "#4b7560");
leaf(16, 25, 7, 23, 27, 9, "#547f69");
// Mossy tufts and tiny storybook mushrooms at the foot
for (let i = 0; i < 28; i++) {
const x = 8 + Math.floor(rand() * 15);
const y = 18 + Math.floor(rand() * 15);
if (get(x, y, 3)) set(x, y, 4, rand() < 0.5 ? "#708e68" : "#4c725e");
}
for (const [x, y] of [[7, 23], [22, 30], [10, 32]]) {
box(x, y, 0, x, y, 2, "#d8c5a7");
ellipsoid(x, y, 3, 2, 2, 1, "#c46888");
set(x - 1, y - 1, 4, "#fff1cc");
}
// Hook, hanging loop, and warm brass bulb cap
line(34, 23, 37, 33, 23, 34, 1, "#a78b5d");
sphere(33, 23, 35, 1, "#e4c277");
cylinder(33, 23, 32, 3, 3, "#92744f");
cylinder(33, 23, 34, 2, 1, "#e2bc73");
for (let x = 30; x <= 36; x++) set(x, 20, 32, "#e6c781");
// The fairy sits inside the bulb, close to its clear front
ellipsoid(28, 20, 23, 3, 1, 4, "#9c6ab5");
ellipsoid(38, 20, 23, 3, 1, 4, "#9c6ab5");
ellipsoid(28, 19, 24, 2, 1, 3, "#e4a4e9");
ellipsoid(38, 19, 24, 2, 1, 3, "#e4a4e9");
ellipsoid(33, 18, 21, 2, 2, 3, "#bf679e");
sphere(33, 18, 26, 3, "#ffc4d8");
sphere(32, 17, 27, 2, "#ffe0d6");
set(31, 14, 26, "#473c59");
set(34, 14, 26, "#473c59");
set(32, 14, 24, "#bd5e84");
line(32, 18, 20, 30, 17, 18, 0, "#ffdcaf");
line(34, 18, 20, 36, 17, 18, 0, "#ffdcaf");
// The animated fairy light: a little star in her hands
part("light", [33, 16, 22]);
sphere(33, 15, 22, 2, "#fff4bd");
for (const [x, y, z] of [
[33, 15, 26], [33, 15, 18], [29, 15, 22], [37, 15, 22],
[30, 14, 25], [36, 14, 25], [30, 14, 19], [36, 14, 19]
]) set(x, y, z, "#ff76c8");
animate("light", {
type: "colors",
palette: ["#ff73c8", "#ffe26b", "#ffffff"],
pattern: "flicker",
glow: 1
});
part("body");
// Glass is mostly open at the front, so the fairy remains visible.
const cx = 33, cy = 23, cz = 24;
for (let x = 25; x <= 41; x++) {
for (let y = 15; y <= 31; y++) {
for (let z = 15; z <= 33; z++) {
const d = ((x - cx) / 8) ** 2 +
((y - cy) / 8) ** 2 +
((z - cz) / 9) ** 2;
if (d < 0.79 || d > 1.04) continue;
const edge = x <= 27 || x >= 39 || z <= 17 || z >= 31;
if (y < 22 && !edge && rand() < 0.92) continue;
if (rand() < (edge ? 0.24 : 0.42)) {
set(x, y, z, rand() < 0.7 ? "#82c9c3" : "#b9e5d9");
}
}
}
}
// Bright curved reflections along the glass
for (let z = 19; z <= 29; z++) {
if (z !== 23 && z !== 24) {
set(27, 19, z, "#d4f5eb");
if (z > 22) set(39, 20, z, "#8edfd7");
}
}
cylinder(33, 23, 15, 3, 1, "#a98961");
sphere(33, 23, 14, 2, "#d6ad70");
set(33, 20, 14, "#ffe3a2");import { draw } from "./assets/voxel";
import { lamparaDeHada } from "./assets/lampara-de-hada";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, lamparaDeHada, 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-hada
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["lampara-de-hada"] })
# Queda en client/assets/lampara-de-hada.ts
# https://fogon.page/object/lampara-de-hada