← Whole house3D assetfogon/lampara-colgante
Lámpara colgante
Drag to turn it// «Lámpara colgante» · gpt-6-sol (medium)
// A pendant lamp: a big bell-shaped metal shade in mustard yellow with a white inside and a glowing bulb peeking out, hanging from a thin black cord from a small round ceiling plate, mounted on a tall slim black floor stand so it stands on the ground.
const black = "#292a29";
const blackLight = "#40413d";
const blackShade = "#1c1d1c";
const gold = "#d8a52d";
const goldLight = "#edc34f";
const goldDark = "#ad7820";
const cream = "#fff8e8";
// Weighted floor base and tall, slim stand.
cylinder(40, 25, 0, 5, 2, blackShade);
cylinder(40, 25, 2, 4, 1, black);
cylinder(40, 25, 3, 2, 2, blackLight);
line(40, 25, 4, 40, 25, 43, 1, black);
line(39, 24, 5, 39, 24, 42, 0, blackLight);
// Overhead arm and small round mounting plate.
line(40, 25, 43, 38, 25, 45, 1, black);
line(38, 25, 45, 23, 23, 45, 1, black);
cylinder(23, 23, 42, 3, 2, blackShade);
cylinder(23, 23, 44, 2, 1, blackLight);
cylinder(23, 23, 41, 1, 2, black);
// The cord, shade, and bulb swing together from the plate.
part("pendant", [23, 23, 42]);
animate("pendant", { type: "swing", axis: "x", speed: 1.5, amplitude: 0.15 });
line(23, 23, 34, 23, 23, 41, 0, blackShade);
cylinder(23, 23, 32, 2, 3, goldDark);
cylinder(23, 23, 33, 1, 2, goldLight);
// Rounded bell profile, built as a thick-walled shade.
const profile = {
18: 16, 19: 16, 20: 15.5, 21: 15, 22: 14.5,
23: 14, 24: 13, 25: 12, 26: 11, 27: 10,
28: 8.5, 29: 7, 30: 6, 31: 5, 32: 4, 33: 3
};
for (let z = 18; z <= 33; z++) {
const r = profile[z];
for (let x = 23 - Math.ceil(r); x <= 23 + Math.ceil(r); x++) {
for (let y = 23 - Math.ceil(r); y <= 23 + Math.ceil(r); y++) {
const d = Math.hypot(x - 23, y - 23);
if (d > r || (z < 29 && d < r - 2.6)) continue;
let c = z < 21 || y > 28 ? goldDark : gold;
if (z >= 23 && (y < 21 || x < 20)) c = goldLight;
if (rand() < 0.045) c = c === goldLight ? gold : goldLight;
set(x, y, z, c);
}
}
}
// A broad white underside makes the hollow shade readable from below.
for (const [z, inner, outer] of [
[17, 8, 14], [18, 7, 14], [19, 8, 13], [20, 9, 12]
]) {
for (let x = 8; x <= 38; x++) {
for (let y = 8; y <= 38; y++) {
const d = Math.hypot(x - 23, y - 23);
if (d >= inner && d <= outer)
set(x, y, z, rand() < 0.12 ? "#e9e5da" : cream);
}
}
}
cylinder(23, 23, 25, 7, 1, cream);
// Thick mustard rolled lip around the opening.
for (let z = 17; z <= 19; z++) {
for (let x = 7; x <= 39; x++) {
for (let y = 7; y <= 39; y++) {
const d = Math.hypot(x - 23, y - 23);
if (d >= 14.5 && d <= 16)
set(x, y, z, z === 17 ? goldDark : gold);
}
}
}
// Socket and a warm, oversized bulb peeking below the shade.
cylinder(23, 23, 21, 2, 5, "#d3c9ad");
cylinder(23, 23, 20, 3, 2, "#eee4ca");
ellipsoid(23, 23, 17, 4, 4, 4, "#fff2c4");
ellipsoid(22, 22, 17, 2, 2, 3, "#fffdf0");
set(21, 19, 17, "#ffffff");import { draw } from "./assets/voxel";
import { lamparaColgante } from "./assets/lampara-colgante";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, lamparaColgante, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: its longest side, in px
// angle: turn on the floor, in radians
// t: seconds; if it moves, that animates it# In a terminal, in the game's folder
fogon assets add lampara-colgante
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["lampara-colgante"] })
# It lands in client/assets/lampara-colgante.ts
# https://fogon.page/object/lampara-colgante