← BásicoObjeto 3Dfogon/bicicleta
Bicicleta
Arrastrá para girarlo// «Bicicleta» · gpt-6-sol (medium)
// Bicycle («Bicicleta»).
// Wheels: dark rubber tires, bright rims, and fine metal spokes.
function wheel(cx, cz, r) {
for (let x = Math.floor(cx - r - 1); x <= Math.ceil(cx + r + 1); x++) {
for (let z = Math.max(0, Math.floor(cz - r - 1)); z <= Math.ceil(cz + r + 1); z++) {
const d = Math.hypot(x - cx, z - cz);
if (d >= r - 1.05 && d <= r + 0.35) {
for (let y = 22; y <= 26; y++)
set(x, y, z, z > cz + 3 ? "#343b3c" : "#171d20");
if (d >= r - 0.35 && d <= r + 0.35) {
set(x, 21, z, "#252b2d");
set(x, 27, z, "#252b2d");
}
}
if (d >= r - 2.55 && d <= r - 1.45) {
set(x, 20, z, z > cz ? "#c3cbca" : "#788889");
set(x, 27, z, "#aebbb9");
if (z > cz && (x + z) % 5 !== 0) set(x, 19, z, "#e2e5dc");
}
}
}
for (let i = 0; i < 12; i++) {
const a = i * Math.PI / 6;
const x = cx + Math.cos(a) * (r - 2);
const z = cz + Math.sin(a) * (r - 2);
line(cx, 19, cz, x, 19, z, 0, i % 3 ? "#9daaa9" : "#d6ddda");
line(cx, 27, cz, x, 27, z, 0, "#728384");
}
cylinder(cx, 19, cz, 1.5, 2, "#68797a", "y");
set(cx, 18, cz, "#e4e6dc");
}
wheel(11, 11, 10.5);
wheel(36, 10, 9.5);
// Tire contact patches reach the floor at z = 0.
box(10, 22, 0, 12, 26, 0, "#171d20");
box(35, 22, 0, 37, 26, 0, "#171d20");
// Rear stays and the silver front fork sit behind the red frame.
line(11, 25, 11, 20, 25, 24, 1, "#596263");
line(11, 25, 11, 23, 25, 11, 1, "#707b79");
line(32, 25, 23, 36, 25, 10, 1.1, "#596568");
line(32, 21, 23, 36, 21, 10, 1.1, "#d3d9d2");
line(34, 20, 17, 36, 20, 10, 0, "#f0eee0");
// The red diamond frame, with darker edges and a light-facing side.
const tubes = [
[11, 11, 20, 24], // rear seat stay
[11, 11, 23, 11], // rear chain stay
[20, 24, 23, 11], // seat tube
[20, 24, 31, 24], // top tube
[31, 24, 23, 11] // down tube
];
for (const [x0, z0, x1, z1] of tubes) {
line(x0, 24, z0, x1, 24, z1, 1.5, "#742e2d");
line(x0, 23, z0, x1, 23, z1, 1, "#b8443e");
line(x0, 22, z0 + 1, x1, 22, z1 + 1, 0, "#ed8070");
}
line(21, 21, 25, 30, 21, 25, 0, "#f3d9c8");
line(20, 25, 24, 22, 25, 12, 0, "#e36b5a");
// Short head tube and its dark fittings.
line(30, 24, 26, 33, 24, 20, 1.5, "#71312f");
line(30, 22, 26, 33, 22, 20, 1, "#c64b42");
box(30, 20, 25, 32, 26, 26, "#d0d5cd");
box(31, 20, 24, 33, 21, 25, "#f2e9d8");
// Orange-brown saddle and its red seatpost.
line(19, 24, 24, 18, 24, 29, 1, "#9d3833");
box(15, 22, 28, 21, 27, 28, "#633d2b");
box(14, 22, 29, 21, 27, 29, "#af6835");
box(15, 22, 30, 20, 26, 30, "#dc9550");
box(16, 23, 31, 19, 25, 31, "#e8a760");
box(14, 21, 29, 17, 21, 29, "#82472d");
box(20, 23, 29, 22, 26, 29, "#99532e");
// Upright handlebar stem and wide, bent handlebars.
line(32, 24, 25, 33, 24, 33, 1, "#647276");
line(32, 22, 27, 33, 22, 32, 0, "#d9ddcf");
line(33, 15, 33, 33, 33, 33, 1, "#657274");
line(33, 16, 34, 33, 32, 34, 0, "#d5d9d0");
line(33, 15, 33, 32, 15, 35, 1, "#515d60");
line(33, 33, 33, 34, 33, 35, 1, "#515d60");
for (const y of [13, 32]) {
box(31, y, 34, 35, y + 2, 35, "#82502d");
box(31, y, 36, 35, y + 2, 36, "#c47a39");
box(32, y, 37, 34, y + 1, 37, "#de9850");
set(31, y, 35, "#e5a45c");
}
// Chainring, chain, crank arms, and chunky pedals.
cylinder(23, 18, 11, 3, 2, "#4c5657", "y");
cylinder(23, 17, 11, 2, 1, "#b5c1bd", "y");
cylinder(11, 18, 11, 1.5, 2, "#596566", "y");
line(11, 17, 13, 23, 17, 14, 0, "#778583");
line(11, 17, 9, 23, 17, 8, 0, "#6e7876");
line(23, 16, 11, 26, 16, 7, 1, "#818e8d");
box(24, 13, 6, 28, 19, 7, "#313b3c");
box(25, 13, 8, 27, 18, 8, "#929d99");
line(23, 27, 11, 20, 27, 15, 1, "#8d9995");
box(18, 27, 15, 22, 30, 16, "#343d3e");
// Visible axle caps and small glints on the near wheel faces.
for (const [x, z] of [[11, 11], [36, 10]]) {
cylinder(x, 18, z, 1.5, 2, "#59676a", "y");
set(x, 17, z, "#e8e9dc");
}import { draw } from "./assets/voxel";
import { bicicleta } from "./assets/bicicleta";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, bicicleta, 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 bicicleta
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["bicicleta"] })
# Queda en client/assets/bicicleta.ts
# https://fogon.page/object/bicicleta