← Animals3D assetfogon/cocodrilo
Cocodrilo
Drag to turn it// «Cocodrilo» · gpt-6-sol (medium)
// A cartoon crocodile lying low, horizontal along y, head at the front (-y): a long flat body in dark green with a lighter yellow-green belly and a row of bumpy ridges along the back and tail, a long flat snout with a row of white teeth showing, bulging eyes on top of the head and four short splayed legs. A long thick tail tapering behind.
const dark = "#245b32";
const green = "#347d3d";
const light = "#4d9948";
const ridge = "#286c37";
const belly = "#b6c96a";
const bellyShade = "#91ad55";
const mouth = "#35452d";
const tooth = "#fff6dc";
// Low, rounded body and bright belly.
ellipsoid(24, 26, 9, 10, 11, 7, dark);
ellipsoid(24, 25, 5, 9, 10, 3, bellyShade);
ellipsoid(24, 25, 6, 8, 9, 2, belly);
ellipsoid(24, 26, 12, 9, 10, 4, green);
// Sparse scales on the broad back.
for (let y = 20; y <= 34; y += 3) {
for (const x of [17, 19, 29, 31]) {
const z = x === 17 || x === 31 ? 12 : 15;
if (get(x, y, z)) set(x, y, z, rand() < 0.5 ? light : ridge);
}
}
// Big head, with a long, flattened muzzle and a visible lower jaw.
ellipsoid(24, 16, 8, 9, 8, 5, dark);
ellipsoid(24, 11, 6, 8, 8, 2, bellyShade);
ellipsoid(24, 10, 7, 8, 7, 2, belly);
ellipsoid(24, 8, 8, 8, 5, 3, dark);
box(17, 5, 7, 31, 13, 10, green);
ellipsoid(24, 16, 11, 8, 6, 3, green);
box(18, 5, 11, 30, 10, 11, light);
// Dark mouth seam and chunky white teeth along both sides.
for (let y = 5; y <= 15; y++) {
set(16, y, 7, mouth);
set(32, y, 7, mouth);
}
for (let y = 6; y <= 15; y += 2) {
for (const x of [16, 32]) {
set(x, y, 8, tooth);
set(x, y, 9, tooth);
}
}
box(20, 4, 7, 28, 4, 7, mouth);
for (const x of [20, 23, 26, 28]) set(x, 4, 8, tooth);
// Nostrils near the tip.
for (const x of [20, 28]) {
set(x, 6, 12, dark);
set(x, 7, 12, dark);
}
// Bulging eye mounds, looking toward the front.
for (const x of [18, 30]) {
sphere(x, 15, 15, 3, light);
box(x - 1, 12, 16, x + 1, 12, 18, "#f2eec8");
box(x, 11, 17, x + 1, 12, 18, "#172b20");
set(x, 11, 19, "#ffffff");
}
// Two rows of raised, bumpy back ridges.
for (let y = 21; y <= 35; y += 3) {
for (const x of [21, 27]) {
box(x - 1, y, 15, x + 1, y + 1, 16, ridge);
set(x, y, 17, light);
}
}
// Tail pivots at its root and narrows to a rounded tip.
part("tail", [24, 35, 9]);
for (let y = 34; y <= 46; y++) {
const t = (y - 34) / 12;
const rx = 7 - 5.7 * t;
const rz = 4.5 - 2.4 * t;
for (let x = Math.ceil(24 - rx); x <= Math.floor(24 + rx); x++) {
for (let z = 3; z <= 13; z++) {
const shape = ((x - 24) / rx) ** 2 + ((z - 7.5) / rz) ** 2;
if (shape <= 1) {
set(x, y, z, z < 6 ? bellyShade : z > 9 ? green : dark);
}
}
}
}
for (let y = 36; y <= 44; y += 2) {
const t = (y - 34) / 12;
const top = Math.floor(7.5 + 4.5 - 2.4 * t);
const offset = y < 41 ? 2 : 1;
for (const x of [24 - offset, 24 + offset]) {
set(x, y, top + 1, ridge);
if (y < 43) set(x, y, top + 2, light);
}
}
animate("tail", { type: "swing", axis: "z", speed: 3, amplitude: 0.3 });
part("body");
// Short splayed legs, each swinging independently.
function leg(name, x, y, side, speed) {
part(name, [x, y, 8]);
ellipsoid(x, y, 7, 3, 3, 3, dark);
ellipsoid(x + side * 3, y, 4, 3, 3, 3, green);
ellipsoid(x + side * 5, y - 1, 1, 3, 3, 1, dark);
for (let dy = -3; dy <= 1; dy += 2) {
set(x + side * 7, y + dy, 1, belly);
set(x + side * 7, y + dy, 0, bellyShade);
}
animate(name, { type: "swing", axis: "x", speed, amplitude: 0.25 });
}
leg("front-left", 15, 20, -1, 5);
leg("front-right", 33, 20, 1, -5);
leg("rear-left", 15, 32, -1, -5);
leg("rear-right", 33, 32, 1, 5);import { draw } from "./assets/voxel";
import { cocodrilo } from "./assets/cocodrilo";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, cocodrilo, 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 cocodrilo
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["cocodrilo"] })
# It lands in client/assets/cocodrilo.ts
# https://fogon.page/object/cocodrilo