← Casa completaObjeto 3Dfogon/reloj-de-pared
Reloj de pared
Arrastrá para girarlo// «Reloj de pared» · gpt-6-sol (medium)
// A big round wall clock on a small stand: a white face with black numbers and a red rim, thick black hour and minute hands and a thin red second hand, standing upright on a short wooden foot.
// A cheerful, chunky clock, facing toward -y.
const cx = 24, cy = 23, cz = 26;
// Wooden foot: a broad base with a short stem tucked behind the clock.
box(14, 17, 0, 34, 30, 1, "#9b6238");
box(15, 18, 2, 33, 29, 3, "#c58a4d");
box(16, 19, 4, 32, 28, 4, "#dfaa67");
box(21, 22, 5, 27, 27, 12, "#a96d3e");
box(22, 21, 5, 26, 22, 11, "#d39a5b");
box(19, 20, 5, 29, 28, 7, "#bc7d45");
// Rounded clock case and dark-red sidewall.
for (let y = 20; y <= 26; y++) {
const radius = y === 26 ? 15.5 : y === 25 ? 17 : 18;
for (let x = 5; x <= 43; x++) for (let z = 7; z <= 45; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d <= radius) {
set(x, y, z, d > radius - 2 ? "#aa3635" : "#c94b46");
}
}
}
// Cream-white face, with a little warm variation.
for (let x = 6; x <= 42; x++) for (let z = 8; z <= 44; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d <= 16) {
const shade = rand();
const face = shade < 0.10 ? "#eee9dc" : shade < 0.25 ? "#fff9ec" : "#faf7ef";
set(x, 18, z, face);
set(x, 17, z, face);
}
}
// Thick red bezel, with a bright upper edge and a deeper lower edge.
for (let x = 5; x <= 43; x++) for (let z = 7; z <= 45; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d >= 15.8 && d <= 18.5) {
for (let y = 16; y <= 19; y++) {
set(x, y, z, z > cz + 5 ? "#eb6860" : z < cz - 6 ? "#a93636" : "#d84c47");
}
set(x, 15, z, d < 16.6 ? "#f27a68" : "#c8413d");
}
}
// Slim warm trim just inside the bezel.
for (let x = 7; x <= 41; x++) for (let z = 9; z <= 43; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d >= 15.0 && d < 15.8) set(x, 16, z, "#e7c9a5");
}
// Hour marks, leaving room for the four large numerals.
for (let hour = 0; hour < 12; hour++) {
if (hour % 3 === 0) continue;
const a = Math.PI / 2 - hour * Math.PI / 6;
const inner = hour % 3 === 0 ? 12.8 : 13.7;
line(
cx + inner * Math.cos(a), 15, cz + inner * Math.sin(a),
cx + 15 * Math.cos(a), 15, cz + 15 * Math.sin(a),
0, "#393b3c"
);
}
// Pixel numerals: bold enough to read on a small clock.
const glyphs = {
"1": ["010", "110", "010", "010", "111"],
"2": ["111", "001", "111", "100", "111"],
"3": ["111", "001", "111", "001", "111"],
"6": ["111", "100", "111", "101", "111"],
"9": ["111", "101", "111", "001", "111"]
};
function numeral(text, left, bottom) {
let offset = 0;
for (const digit of text) {
glyphs[digit].forEach((row, r) => {
for (let col = 0; col < 3; col++) {
if (row[col] === "1") set(left + offset + col, 15, bottom + 4 - r, "#303235");
}
});
offset += 4;
}
}
numeral("12", 21, 36);
numeral("3", 35, 24);
numeral("6", 23, 11);
numeral("9", 10, 24);
// Fixed black hands: a short hour hand and a longer minute hand.
line(24, 14, 26, 19, 14, 31, 1, "#292b2e");
line(24, 14, 26, 29, 14, 35, 1, "#292b2e");
set(19, 14, 31, "#303235");
set(29, 14, 35, "#303235");
// The fine red second hand rotates around the dial center.
part("second", [24, 12, 26]);
line(24, 12, 23, 24, 12, 38, 0, "#e63936");
line(24, 12, 24, 24, 12, 27, 0, "#ff6050");
sphere(24, 11, 26, 1, "#e9433d");
set(24, 10, 26, "#ff8b72");
animate("second", { type: "spin", axis: "y", speed: 1 });import { draw } from "./assets/voxel";
import { relojDePared } from "./assets/reloj-de-pared";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, relojDePared, 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 reloj-de-pared
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["reloj-de-pared"] })
# Queda en client/assets/reloj-de-pared.ts
# https://fogon.page/object/reloj-de-pared