← Nature3D assetfogon/abedul
Abedul
Drag to turn it// «Abedul» · gpt-6-sol (medium)
// A slender birch tree: a thin tall white trunk with short black horizontal bark marks, slightly leaning, with a light airy crown of bright yellow-green leaf clusters (3 small spheres) on top.
// Slender, gently leaning birch trunk.
function trunkCenter(z) {
return [23 + Math.round(4 * z / 32), 24 - Math.round(z / 20)];
}
for (let z = 0; z <= 32; z++) {
const [cx, cy] = trunkCenter(z);
const r = z < 3 ? 2.35 : z < 23 ? 1.85 : 1.55;
for (let dx = -2; dx <= 2; dx++) {
for (let dy = -2; dy <= 2; dy++) {
if (dx * dx + dy * dy > r * r) continue;
let color = "#eeeedd";
if (dy < 0 || z > 24) color = "#faf8e9";
if (dx > 0 || dy > 0) color = "#c9c9b7";
if (rand() < 0.07) color = "#dddccc";
set(cx + dx, cy + dy, z, color);
}
}
}
// Short, staggered black birch-bark dashes on the viewer-facing side.
for (const [z, offset, length] of [
[3, -1, 2], [6, 0, 3], [9, -1, 2], [12, 0, 2],
[16, -1, 3], [19, 0, 2], [23, -1, 2], [27, 0, 2],
[30, -1, 2]
]) {
const [cx, cy] = trunkCenter(z);
const front = cy - (z < 23 ? 1 : 1);
for (let i = 0; i < length; i++) {
set(cx + offset + i, front, z, i === 0 ? "#55564d" : "#363a35");
}
}
// A few marks wrapping onto the sides.
for (const z of [5, 14, 21, 29]) {
const [cx, cy] = trunkCenter(z);
set(cx + (z < 23 ? 2 : 1), cy, z, "#55564d");
}
const [tx, ty] = trunkCenter(32);
part("crown", [tx, ty, 32]);
// Branches belong to the swaying crown.
line(tx, ty, 32, 20, 24, 36, 1, "#d5d0b3");
line(tx, ty, 32, 33, 25, 37, 1, "#d5d0b3");
line(tx, ty, 32, 26, 21, 39, 1, "#ddd9bd");
// Three distinct, rounded puffs of fresh yellow-green foliage.
sphere(20, 24, 36, 6, "#a9d83e");
sphere(33, 25, 37, 6, "#a9d83e");
sphere(26, 21, 40, 5, "#a9d83e");
forEach((x, y, z, color) => {
if (color !== "#a9d83e") return;
const light = z >= 39 || (z >= 36 && y <= 22);
const shade = z <= 33 || y >= 28;
const n = rand();
if (light) {
set(x, y, z, n < 0.34 ? "#d5ee67" : n < 0.82 ? "#bee64d" : "#a9d83e");
} else if (shade) {
set(x, y, z, n < 0.28 ? "#77b63a" : n < 0.72 ? "#8ecb37" : "#a9d83e");
} else {
set(x, y, z, n < 0.14 ? "#c9e95b" : n < 0.38 ? "#91c935" : "#a9d83e");
}
});
animate("crown", { type: "swing", axis: "y", speed: 1.2, amplitude: 0.08 });import { draw } from "./assets/voxel";
import { abedul } from "./assets/abedul";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, abedul, 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 abedul
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["abedul"] })
# It lands in client/assets/abedul.ts
# https://fogon.page/object/abedul