← AsiáticoObjeto 3Dfogon/elefante-tailandes
Elefante tailandés
Arrastrá para girarlo// «Elefante tailandés» · gpt-6-sol (medium)
// A cartoon Thai elephant with a decorated saddle: grey chunky body horizontal along y, big ears, trunk curled at the front, and on its back a red and gold ornamental cloth with a small golden howdah seat with a little pointed roof.
const gray = "#929598", lightGray = "#b8b9b5", darkGray = "#707579";
const gold = "#efbd4c", brightGold = "#ffdc78", darkGold = "#b77c30";
const red = "#a82732", deepRed = "#751e2b", jade = "#285d52";
function shadedEllipsoid(cx, cy, cz, rx, ry, rz) {
for (let x = Math.floor(cx-rx); x <= Math.ceil(cx+rx); x++)
for (let y = Math.floor(cy-ry); y <= Math.ceil(cy+ry); y++)
for (let z = Math.floor(cz-rz); z <= Math.ceil(cz+rz); z++) {
const d = ((x-cx)/rx)**2 + ((y-cy)/ry)**2 + ((z-cz)/rz)**2;
if (d <= 1) {
let c = z > cz+rz*0.38 ? lightGray : z < cz-rz*0.45 ? darkGray : gray;
if (rand() < 0.07) c = c === gray ? lightGray : gray;
set(x,y,z,c);
}
}
}
// Four independently swinging, broad-footed legs.
for (const [side, x] of [["left",17],["right",31]]) {
for (const [position, y] of [["front",15],["rear",34]]) {
const name = `${position}-${side}`;
part(name, [x,y,15]);
box(x-3,y-3,2, x+3,y+3,15,gray);
box(x-4,y-4,0, x+4,y+4,3,darkGray);
box(x-4,y-4,3, x+4,y+4,5,gray);
for (let dx=-2; dx<=2; dx+=2)
box(x+dx,y-4,0, x+dx+1,y-4,2,"#e9dfcc");
animate(name, {
type:"swing", axis:"x",
speed:(position==="front") === (side==="left") ? 5 : -5,
amplitude:0.3
});
}
}
part("body");
shadedEllipsoid(24,25,18,11,14,9);
shadedEllipsoid(24,13,21,8,8,8);
// Tail and dark tuft behind the rounded body.
line(24,37,21,24,42,15,1,gray);
line(24,42,15,24,43,11,1,darkGray);
ellipsoid(24,43,11,2,1,3,"#484a48");
// Large fan ears, set behind the face.
for (const x of [12,36]) {
ellipsoid(x,12,23,4,3,8,darkGray);
ellipsoid(x,9.5,23,3,1.5,6,gray);
ellipsoid(x,8.5,23,2,1,5,"#ba8588");
ellipsoid(x,8,24,1,1,3,"#d49b99");
}
// Brows and bright, friendly eyes.
for (const x of [18,30]) {
box(x-1,6,26,x+1,8,26,darkGray);
ellipsoid(x,6.5,24,2,1,2,"#eee8d8");
set(x,5,24,"#242e30");
set(x,5,25,"#242e30");
set(x,4,25,"#ffffff");
ellipsoid(x,7,19,2,1,1,lightGray);
}
// Curling trunk has its own pivot at the forehead.
part("trunk",[24,6,19]);
line(24,6,19,24,3,13,3,gray);
line(24,3,13,24,4,9,3,gray);
line(24,4,9,24,7,7,2.5,gray);
line(24,7,7,24,9,10,2,lightGray);
ellipsoid(24,9,10,2,2,2,gray);
set(23,10,10,darkGray);
set(25,10,10,darkGray);
animate("trunk",{type:"swing",axis:"x",speed:2,amplitude:0.25});
part("body");
// Short, curved ivory tusks beside the trunk.
for (const x of [18,30]) {
line(x,8,17,x+(x<24?-1:1),4,15,1.5,"#e8dfc9");
line(x+(x<24?-1:1),4,15,x+(x<24?-2:2),3,18,1,"#fff1d5");
}
// Red saddle cloth: a broad top and hanging embroidered side panels.
box(16,18,26,32,34,28,deepRed);
box(17,19,28,31,33,29,red);
for (const x of [13,34]) {
box(x,19,20,x+1,33,26,red);
box(x,19,26,x+1,33,27,gold);
box(x,19,19,x+1,33,19,darkGold);
for (let y=21; y<=31; y+=4) {
box(x, y,21,x+1,y+1,22,gold);
set(x,y+1,23,brightGold);
set(x+1,y,24,darkGold);
}
}
box(17,18,22,31,19,27,red);
box(17,18,27,31,19,28,gold);
box(17,18,21,31,18,21,darkGold);
for (let x=19; x<=29; x+=3) {
set(x,18,24,brightGold);
set(x+1,18,23,gold);
}
for (let y=20; y<=32; y+=3) {
set(16,y,29,brightGold);
set(32,y,29,brightGold);
}
// Raised golden howdah, open on all four sides.
box(19,22,29,29,30,30,darkGold);
box(20,23,30,28,29,30,red);
for (const x of [19,29]) for (const y of [22,30]) {
box(x,y,30,x+1,y+1,35,gold);
box(x,y,34,x+1,y+1,35,brightGold);
}
for (const y of [22,30]) {
box(20,y,31,28,y,32,darkGold);
for (let x=22; x<=27; x+=3) set(x,y,32,brightGold);
}
for (const x of [19,29]) box(x,24,31,x,28,32,darkGold);
box(22,25,31,26,28,32,deepRed);
box(22,25,32,26,26,33,red);
// Layered glazed roof, with a gold eave and upturned corners.
box(16,19,36,32,33,36,darkGold);
box(16,19,37,32,33,37,gold);
const roof = [
[17,31,20,32,38],
[18,30,21,31,39],
[19,29,22,30,40],
[20,28,23,29,41],
[21,27,24,28,42]
];
for (const [x0,x1,y0,y1,z] of roof) {
box(x0,y0,z,x1,y1,z,jade);
for (let x=x0+2; x<x1; x+=3)
box(x,y0,z,x,y1,z,"#39766a");
box(x0,y0,z,x1,y0,z,"#438473");
}
for (const x of [16,32]) for (const y of [19,33]) {
box(x,y,38,x,y,39,gold);
set(x,y,40,brightGold);
}
box(23,25,43,25,27,43,gold);
set(24,26,44,brightGold);import { draw } from "./assets/voxel";
import { elefanteTailandes } from "./assets/elefante-tailandes";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, elefanteTailandes, 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 elefante-tailandes
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["elefante-tailandes"] })
# Queda en client/assets/elefante-tailandes.ts
# https://fogon.page/object/elefante-tailandes