← AsiáticoObjeto 3Dfogon/onigiri
Onigiri
Arrastrá para girarlo// «Onigiri» · gpt-6-sol (medium)
// A big chunky triangular rice ball: white rice with a light grain noise texture, a dark green nori strip wrapped around the bottom, and a small cute face of black dot eyes and a little smile on the front, standing upright.
const rice = ["#fffaf0", "#f7f1e5", "#eee8da", "#ffffff"];
const frontY = (x, z) => {
const w = Math.min(19 - 0.41 * z, 15.5 + z);
const edge = w - Math.abs(x - 24);
return 10 + Math.max(0, Math.ceil(4 - edge)) + (z === 0 ? 1 : 0);
};
const backY = (x, z) => {
const w = Math.min(19 - 0.41 * z, 15.5 + z);
return 36 - Math.max(0, Math.ceil(4 - (w - Math.abs(x - 24))));
};
// A plump, softly beveled triangular mound of rice.
for (let z = 0; z <= 41; z++) {
let w = Math.min(19 - 0.41 * z, 15.5 + z);
if (z === 41) w = 1.5;
if (z === 40) w = 2.5;
for (let x = Math.ceil(24 - w); x <= Math.floor(24 + w); x++) {
const yf = frontY(x, z);
const yb = backY(x, z);
for (let y = yf; y <= yb; y++) {
let color = rice[0];
if (z >= 37 || y === yf && rand() < 0.15) color = rice[3];
else if (y >= yb - 2 || z <= 2) color = rice[2];
else if (rand() < 0.13) color = rice[1];
set(x, y, z, color);
}
}
}
// Little individual grains visible on the broad front.
for (let i = 0; i < 210; i++) {
const z = 3 + Math.floor(rand() * 35);
const x = 9 + Math.floor(rand() * 31);
if (!get(x, frontY(x, z), z)) continue;
if (z <= 15 && x >= 14 && x <= 34) continue;
const y = frontY(x, z) - 1;
const c = rand() < 0.65 ? "#eae4d7" : "#ffffff";
set(x, y, z, c);
if (rand() < 0.48 && get(x + 1, frontY(x + 1, z), z))
set(x + 1, frontY(x + 1, z) - 1, z, c);
}
// The nori sheet climbs the front, passes underneath, and folds up the back.
for (let x = 14; x <= 34; x++) {
for (let z = 0; z <= 15; z++) {
if (!get(x, frontY(x, z), z)) continue;
const y = frontY(x, z) - 1;
let c = "#173e32";
if (z === 15) c = "#39705a";
else if (z < 3) c = "#102e28";
else if ((x * 7 + z * 11) % 17 < 3) c = "#285745";
set(x, y, z, c);
}
for (let z = 0; z <= 11; z++) {
const y = backY(x, z);
if (get(x, y, z)) set(x, y + 1, z, z === 11 ? "#39705a" : "#173e32");
}
for (let y = 11; y <= 36; y++) {
if (get(x, y, 0)) set(x, y, 0, "#102f29");
}
}
// Subtle woven fibers and a clean upper edge on the nori.
for (let x = 16; x <= 32; x += 4) {
for (let z = 3; z <= 12; z += 3) {
set(x, frontY(x, z) - 2, z, "#356a51");
}
}
// Cute face, safely above the nori.
for (const ex of [18, 29]) {
for (let x = ex; x <= ex + 1; x++)
for (let z = 22; z <= 24; z++)
set(x, frontY(x, z) - 2, z, "#252b27");
set(ex, frontY(ex, 24) - 3, 24, "#ffffff");
}
for (const [x, z] of [[22, 19], [23, 18], [24, 18], [25, 18], [26, 19]])
set(x, frontY(x, z) - 2, z, "#30332e");
for (const x of [15, 16, 32, 33])
set(x, frontY(x, 19) - 2, 19, "#edb5ac");import { draw } from "./assets/voxel";
import { onigiri } from "./assets/onigiri";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, onigiri, 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 onigiri
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["onigiri"] })
# Queda en client/assets/onigiri.ts
# https://fogon.page/object/onigiri