← Piezas de nivel 2Objeto 3Dfogon/nivel-trampolin
Trampolín
Arrastrá para girarlo// «Trampolín» · gpt-6-sol (medium)
// A round trampoline: a blue frame ring radius 22 at z 10..11, six short angled blue legs down to z 0, a black stretched mat filling the ring at z 10 with a lighter center circle, and a colorful padding ring around the edge in alternating red and yellow sections.
const cx = 24, cy = 24;
const TAU = Math.PI * 2;
// Six short legs, angled outward from the frame to the floor.
for (let i = 0; i < 6; i++) {
const a = TAU * i / 6;
const dx = Math.cos(a), dy = Math.sin(a);
line(cx + dx * 20.5, cy + dy * 20.5, 1,
cx + dx * 19.2, cy + dy * 19.2, 10,
1.5, "#1672c5");
line(cx + dx * 20.5, cy + dy * 20.5, 0,
cx + dx * 20.5, cy + dy * 20.5, 1,
1.7, "#125a9f");
sphere(cx + dx * 20.5, cy + dy * 20.5, 0, 1.7, "#238ce0");
}
// Solid blue frame beneath the padding.
for (let y = 2; y <= 46; y++) {
for (let x = 2; x <= 46; x++) {
const r = Math.hypot(x - cx, y - cy);
if (r >= 18.8 && r <= 22.2) {
set(x, y, 10, r > 21.3 ? "#125aab" : "#1877ce");
set(x, y, 11, r > 21.3 ? "#176fc0" : "#2895e7");
}
}
}
// Alternating, chunky red and yellow safety pads.
for (let y = 2; y <= 46; y++) {
for (let x = 2; x <= 46; x++) {
const r = Math.hypot(x - cx, y - cy);
if (r < 19.3 || r > 22.15) continue;
let a = Math.atan2(y - cy, x - cx);
if (a < 0) a += TAU;
const segment = Math.floor((a + TAU / 24) / (TAU / 12)) % 12;
const yellow = segment % 2 === 1;
set(x, y, 12, yellow ? "#ffdb36" : "#f54240");
if (r >= 21.3) set(x, y, 11, yellow ? "#e9aa23" : "#cc3038");
}
}
// The stretched mat is the only moving piece.
part("lona", [24, 24, 10]);
for (let y = 5; y <= 43; y++) {
for (let x = 5; x <= 43; x++) {
const r = Math.hypot(x - cx, y - cy);
if (r > 19.0) continue;
let color = "#252b35";
if (r > 17.7) color = "#131923";
else if (r < 7.1) color = "#3c4350";
if (r >= 6.5 && r < 7.3) color = "#596371";
set(x, y, 10, color);
}
}
animate("lona", { type: "bob", axis: "z", amplitude: 1.5, speed: 4 });import { draw } from "./assets/voxel";
import { nivelTrampolin } from "./assets/nivel-trampolin";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelTrampolin, 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 nivel-trampolin
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-trampolin"] })
# Queda en client/assets/nivel-trampolin.ts
# https://fogon.page/object/nivel-trampolin