← Whole house3D assetfogon/alfombra-redonda
Alfombra redonda
Drag to turn it// «Alfombra redonda» · gpt-6-sol (medium)
// A big round rug lying flat on the floor, 2-3 blocks thick: concentric rings of color (terracotta, cream, mustard, teal) with a little geometric zig-zag border and short fringe tufts around the edge.
const cx = 24, cy = 24;
const R = 19;
const colors = {
terracotta: ["#c97860", "#d9886d", "#e3977b"],
cream: ["#eee0bb", "#f6e9ca", "#fff0d5"],
mustard: ["#caa042", "#dbb452", "#e7bf61"],
teal: ["#4c9691", "#60aaa3", "#73b9af"]
};
function shade(name, top) {
const palette = colors[name];
if (!top) return palette[0];
return rand() < 0.11 ? palette[2] : palette[1];
}
// Solid, softly rounded woven body.
for (let x = cx - R; x <= cx + R; x++) {
for (let y = cy - R; y <= cy + R; y++) {
const dx = x - cx, dy = y - cy;
const r = Math.hypot(dx, dy);
if (r > R + 0.15) continue;
let band;
if (r < 4.1) band = "mustard";
else if (r < 6.1) band = "cream";
else if (r < 9.2) band = "terracotta";
else if (r < 11.3) band = "mustard";
else if (r < 13.5) band = "cream";
else if (r < 17.5) band = "teal";
else band = "terracotta";
set(x, y, 0, shade(band, false));
set(x, y, 1, shade(band, false));
set(x, y, 2, shade(band, true));
// Continuous cream zigzag woven into the wide teal border.
if (r >= 14.1 && r < 17.4) {
const angle = Math.atan2(dy, dx);
const phase = ((angle / (Math.PI * 2) * 20) % 1 + 1) % 1;
const zig = 2 * Math.abs(phase - 0.5);
const path = 14.75 + zig * 1.85;
if (Math.abs(r - path) < 0.58) {
set(x, y, 2, rand() < 0.12 ? "#fff0d5" : "#f3e5c3");
}
}
// Tiny, regularly spaced stitches inside the terracotta ring.
if (r > 7.4 && r < 8.35) {
const angle = Math.atan2(dy, dx);
const phase = ((angle / (Math.PI * 2) * 28) % 1 + 1) % 1;
if (phase < 0.31) set(x, y, 2, "#f3d5a3");
}
// A small central diamond, legible from above.
const diamond = Math.abs(dx) + Math.abs(dy);
if (diamond <= 2) set(x, y, 2, "#e9d8ad");
if (diamond <= 1) set(x, y, 2, "#ca795f");
}
}
// Short, separated yarn tufts all the way around the edge.
for (let i = 0; i < 72; i++) {
const angle = i * Math.PI * 2 / 72;
const length = 1.7 + (i % 4 === 0 ? 0.8 : i % 3 === 0 ? 0.4 : 0);
const color = i % 5 === 0 ? "#e4cca5" : i % 3 === 0 ? "#fff0d3" : "#f2dfb8";
for (let d = 18.9; d <= 19.2 + length; d += 0.3) {
const x = Math.round(cx + Math.cos(angle) * d);
const y = Math.round(cy + Math.sin(angle) * d);
set(x, y, 0, color);
if (d < 20.15) set(x, y, 1, color);
}
}import { draw } from "./assets/voxel";
import { alfombraRedonda } from "./assets/alfombra-redonda";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, alfombraRedonda, 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 alfombra-redonda
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["alfombra-redonda"] })
# It lands in client/assets/alfombra-redonda.ts
# https://fogon.page/object/alfombra-redonda