← NaturalezaObjeto 3Dfogon/arbol-frutal
Árbol de manzanas
Arrastrá para girarlo// «Árbol de manzanas» · gpt-6-sol (medium)
// A small round apple tree: a short brown trunk and a bushy bright green crown dotted with about a dozen shiny red apples, plus two apples fallen on the ground.
// Short, warm-brown trunk with a broad, rooted base.
ellipsoid(24, 24, 2, 6, 5, 3, "#95602f");
cylinder(24, 24, 2, 4, 16, "#a86b34");
ellipsoid(24, 24, 15, 5, 5, 4, "#a86b34");
for (const [x, y, dx, dy] of [
[20, 22, -4, -2], [28, 22, 4, -2],
[20, 27, -4, 3], [28, 27, 4, 3]
]) {
line(24, 24, 3, x + dx / 2, y + dy / 2, 0, 2, "#895529");
}
// A few bark highlights and dark grooves on the viewer-facing side.
for (let z = 3; z <= 15; z++) {
if (z % 5 !== 0) set(22, 20, z, "#c18443");
if (z % 4 !== 1) set(26, 20, z, "#774522");
}
line(24, 20, 4, 24, 20, 9, 0, "#774522");
line(21, 21, 10, 21, 21, 14, 0, "#774522");
// Solid overlapping leaf masses make a rounded, scalloped crown.
ellipsoid(24, 24, 27, 15, 15, 14, "#39bb43");
ellipsoid(14, 21, 27, 8, 9, 10, "#36b83e");
ellipsoid(34, 21, 28, 8, 9, 10, "#3fc549");
ellipsoid(23, 14, 27, 10, 7, 9, "#43c749");
ellipsoid(24, 34, 29, 10, 8, 10, "#39b942");
ellipsoid(17, 29, 33, 8, 8, 9, "#43c64a");
ellipsoid(31, 29, 33, 8, 8, 9, "#48ca4e");
ellipsoid(20, 20, 36, 8, 8, 7, "#50cf51");
ellipsoid(29, 22, 37, 8, 8, 7, "#54d256");
// Sunlit tops, shady undersides, and tiny variations in the leaves.
forEach((x, y, z, color) => {
if (!["#39bb43", "#36b83e", "#3fc549", "#43c749",
"#39b942", "#43c64a", "#48ca4e", "#50cf51",
"#54d256"].includes(color)) return;
const n = rand();
if (z < 22) {
if (n < 0.48) set(x, y, z, "#2f9f38");
else if (n < 0.65) set(x, y, z, "#35aa3b");
} else if (z > 34) {
if (n < 0.37) set(x, y, z, "#65dc5d");
else if (n < 0.59) set(x, y, z, "#57d453");
} else if (n < 0.12) set(x, y, z, "#65d85c");
else if (n < 0.21) set(x, y, z, "#2fa93a");
});
// Glossy apples, each with a small stem, leaf, and white shine.
function apple(x, y, z, fallen = false) {
sphere(x, y, z, 2, "#e93d32");
set(x, y - 2, z, "#c92c2b");
set(x - 1, y - 1, z + 1, "#ff7961");
set(x, y - 2, z + 1, "#fff2c5");
set(x, y, z + 2, "#6d4427");
set(x + 1, y, z + 2, "#358e36");
if (fallen) set(x + 2, y, z + 1, "#4bab42");
}
[
[24, 8, 27], [17, 11, 32], [31, 11, 31],
[13, 14, 23], [36, 15, 25], [22, 12, 36],
[11, 20, 30], [38, 20, 32], [29, 16, 37],
[17, 26, 40], [31, 27, 41], [35, 32, 31]
].forEach(([x, y, z]) => apple(x, y, z));
apple(13, 13, 2, true);
apple(35, 12, 2, true);import { draw } from "./assets/voxel";
import { arbolFrutal } from "./assets/arbol-frutal";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, arbolFrutal, 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 arbol-frutal
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["arbol-frutal"] })
# Queda en client/assets/arbol-frutal.ts
# https://fogon.page/object/arbol-frutal