← City3D assetfogon/tacho-de-basura
Tacho de basura
Drag to turn it// «Tacho de basura» · gpt-6-sol (medium)
// A city street trash bin: a dark green cylindrical metal bin with vertical slats on a short post fixed to the ground, with a domed lid with a front opening and a small white recycling symbol on the front (-y). A crumpled paper peeks out of the opening.
const cx = 24, cy = 24;
const dark = "#12382f";
const green = "#205a48";
const light = "#34765a";
const edge = "#448467";
// Round foot and short iron post.
cylinder(cx, cy, 0, 7, 2, dark);
cylinder(cx, cy, 2, 6, 1, green);
cylinder(cx, cy, 3, 3, 12, dark);
cylinder(cx, cy, 4, 2, 10, green);
cylinder(cx, cy, 12, 5, 3, dark);
// Solid bin with narrow vertical grooves between its metal slats.
for (let z = 14; z <= 32; z++) {
for (let x = 11; x <= 37; x++) {
for (let y = 11; y <= 37; y++) {
const dx = x - cx, dy = y - cy;
const r = Math.hypot(dx, dy);
if (r > 12) continue;
let color = dark;
if (r > 10.2) {
const a = Math.atan2(dy, dx);
const slat = Math.abs(Math.sin(a * 11));
color = slat < 0.18 ? dark : (dy < -3 ? light : green);
if (r > 11.3 && slat >= 0.18 && rand() < 0.035) color = edge;
}
set(x, y, z, color);
}
}
}
// Heavy bands hold the slats together.
for (const z of [14, 15, 30, 31, 32]) {
for (let x = 11; x <= 37; x++) for (let y = 11; y <= 37; y++) {
const r = Math.hypot(x - cx, y - cy);
if (r >= 11 && r <= 13) {
set(x, y, z, z === 15 || z === 31 ? light : dark);
}
}
}
// Shallow, rounded lid. Leave a wide opening on its front face.
for (let z = 33; z <= 41; z++) {
for (let x = 10; x <= 38; x++) for (let y = 10; y <= 38; y++) {
const q = ((x - cx) / 13) ** 2 + ((y - cy) / 13) ** 2
+ ((z - 33) / 8) ** 2;
if (q > 1) continue;
if (x >= 17 && x <= 31 && y <= 17 && z <= 37) continue;
set(x, y, z, z >= 39 ? light : (y < 24 ? green : dark));
}
}
// Crisp lip, shadowed inside, and a little highlight above the slot.
box(17, 12, 32, 31, 17, 33, dark);
box(18, 17, 34, 30, 18, 37, "#0c2925");
line(17, 13, 34, 17, 16, 37, 0, edge);
line(31, 13, 34, 31, 16, 37, 0, edge);
line(18, 15, 38, 30, 15, 38, 0, edge);
// A folded, crumpled sheet protrudes from the opening.
box(22, 14, 34, 26, 17, 35, "#d9d8c6");
box(21, 13, 36, 25, 16, 37, "#f2efdb");
box(23, 12, 38, 26, 15, 39, "#fff9e8");
set(21, 14, 38, "#d9d8c6");
set(26, 13, 36, "#c7c7b7");
set(24, 12, 37, "#d1d0bf");
set(26, 14, 39, "#dedbc8");
// Project the small white recycling mark onto the curved front.
function mark(x, z, color = "#f5f4e8") {
const dx = x - cx;
const y = Math.round(cy - Math.sqrt(12 * 12 - dx * dx)) - 1;
set(x, y, z, color);
}
function stroke(x0, z0, x1, z1) {
const n = Math.max(Math.abs(x1 - x0), Math.abs(z1 - z0));
for (let i = 0; i <= n; i++)
mark(Math.round(x0 + (x1 - x0) * i / n),
Math.round(z0 + (z1 - z0) * i / n));
}
stroke(21, 26, 24, 29);
stroke(24, 29, 27, 26);
stroke(28, 25, 29, 22);
stroke(29, 22, 25, 21);
stroke(23, 21, 19, 21);
stroke(19, 21, 20, 25);
// Three chunky arrowheads.
for (const [x, z] of [
[23, 29], [24, 30], [25, 29],
[29, 23], [30, 23], [28, 21],
[19, 23], [18, 22], [21, 21]
]) mark(x, z);import { draw } from "./assets/voxel";
import { tachoDeBasura } from "./assets/tacho-de-basura";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, tachoDeBasura, 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 tacho-de-basura
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["tacho-de-basura"] })
# It lands in client/assets/tacho-de-basura.ts
# https://fogon.page/object/tacho-de-basura