← NaturalezaObjeto 3Dfogon/juncos
Juncos
Arrastrá para girarlo// «Juncos» · gpt-6-sol (medium)
// A clump of reeds and cattails: tall thin green stalks with brown cylindrical cattail heads, growing from a little patch of water and mud.
// Mud bank and shallow water
for (let x = 7; x <= 41; x++) {
for (let y = 9; y <= 39; y++) {
const d = ((x - 24) / 17) ** 2 + ((y - 24) / 15) ** 2;
if (d > 1.05) continue;
set(x, y, 0, rand() < 0.25 ? "#94643f" : "#aa7647");
if (d > 0.73) {
set(x, y, 1, rand() < 0.3 ? "#855a39" : "#b68550");
if (rand() < 0.13) set(x, y, 2, "#76ac43");
} else {
set(x, y, 1, rand() < 0.22 ? "#48b8df" : "#50c5e8");
set(x, y, 2, rand() < 0.27 ? "#7cdef1" : "#59ceec");
}
}
}
// Little glints and curved ripples on the exposed water
for (const [x, y] of [[12, 22], [13, 22], [36, 18], [37, 18],
[20, 35], [21, 35], [29, 12], [30, 12]]) {
set(x, y, 3, "#c5f5f5");
}
for (const [x, y] of [[10, 28], [35, 35], [12, 13], [39, 25]]) {
ellipsoid(x, y, 2, 2, 1, 1, "#b5b4a4");
set(x, y - 1, 3, "#ddddc4");
set(x + 1, y, 3, "#82ad55");
}
// Tall, tapering reed leaves. Each is a slightly curved vertical ribbon.
function leaf(x, y, dx, dy, height, shade) {
const sideX = Math.abs(dy) > Math.abs(dx) ? 1 : 0;
const sideY = sideX ? 0 : 1;
for (let i = 0; i <= height; i++) {
const t = i / height;
const bend = t * t * (1.35 - 0.35 * t);
const px = Math.round(x + dx * bend);
const py = Math.round(y + dy * bend);
const z = 3 + i;
const width = t < 0.12 ? 1 : t < 0.62 ? 2 : t < 0.83 ? 1 : 0;
for (let w = -width; w <= width; w++) {
set(px + sideX * w, py + sideY * w, z,
w < 0 ? "#348c42" : w > 0 ? "#8ad653" : shade);
}
}
}
const leaves = [
[13, 18, -7, -3, 28], [15, 22, -8, 2, 24],
[17, 27, -6, 7, 30], [19, 19, -3, -7, 32],
[21, 28, -3, 8, 27], [23, 20, 1, -8, 30],
[25, 27, 3, 8, 29], [27, 16, 5, -5, 27],
[29, 25, 8, -2, 32], [32, 29, 7, 6, 26],
[34, 22, 7, -5, 25], [14, 30, -5, 5, 22],
[24, 32, 1, 7, 25], [35, 30, 5, 5, 22],
[18, 14, -3, -5, 23], [30, 33, 4, 6, 24]
];
for (const [x, y, dx, dy, h] of leaves) {
leaf(x, y, dx, dy, h, rand() < 0.5 ? "#5fbd49" : "#72c94d");
}
// Upright cattails, with rounded chocolate-brown seed heads.
const cattails = [
[12, 21, -1, 19, 32, 7],
[19, 16, -1, 15, 35, 8],
[27, 19, 1, 18, 31, 7],
[35, 22, 1, 21, 34, 8],
[17, 30, -1, 31, 28, 7],
[26, 31, 0, 32, 33, 8],
[34, 32, 1, 33, 27, 7]
];
for (const [bx, by, lean, hy, headZ, headH] of cattails) {
box(bx - 1, by - 1, 2, bx + 1, by + 1, 5, "#398e43");
line(bx, by, 5, bx + lean, hy, headZ + 1, 0, "#429b46");
line(bx + 1, by, 7, bx + lean + 1, hy, headZ - 1, 0, "#8ad353");
const hx = bx + lean;
cylinder(hx, hy, headZ, 1.8, headH, "#a35a2e");
ellipsoid(hx, hy, headZ + headH - 1, 1.8, 1.8, 1.7, "#b97038");
ellipsoid(hx, hy, headZ, 1.8, 1.8, 1.3, "#8d4829");
for (let z = headZ + 1; z < headZ + headH - 1; z++) {
set(hx - 1, hy - 1, z, z % 3 === 0 ? "#d18a47" : "#be7139");
set(hx + 1, hy + 1, z, "#854123");
}
set(hx, hy, headZ + headH, "#d49350");
}
// Small flowers and tufts along the muddy rim
for (const [x, y, petal] of [
[11, 31, "#ffe475"], [37, 13, "#ff9ab1"], [29, 37, "#fff08a"]
]) {
line(x, y, 2, x, y, 5, 0, "#4b9d42");
for (const [dx, dy] of [[-1, 0], [1, 0], [0, -1], [0, 1]]) {
set(x + dx, y + dy, 6, petal);
}
set(x, y, 6, "#ed9a38");
}import { draw } from "./assets/voxel";
import { juncos } from "./assets/juncos";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, juncos, 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 juncos
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["juncos"] })
# Queda en client/assets/juncos.ts
# https://fogon.page/object/juncos