← Weapons3D assetfogon/arma-rayo
Báculo de rayos
Drag to turn it// «Báculo de rayos» · propio
// A magic lightning staff: dark wooden staff with a big glowing cyan orb crackling with electricity at the tip.
const colors = () => {};
// ---------- palette ----------
const WD = "#2a1c12", WM = "#43301f", WL = "#5e442c", WH = "#7d5c3c";
const LEA_D = "#241a12", LEA = "#3d2c1d";
const BRS_D = "#7a5c22", BRS = "#b8944a", BRS_L = "#e8d08a";
function woodShade(x, y, z) {
const n = Math.sin(x * 0.7 + y * 0.4) * 0.45
+ Math.sin(y * 1.9 + z * 1.3) * 0.30
+ Math.sin(x * 0.22 + z * 0.9) * 0.25;
if (n > 0.45) return WH;
if (n > 0.00) return WL;
if (n > -0.45) return WM;
return WD;
}
// ---------- shaft ----------
for (let x = 3; x <= 31; x++) {
for (let y = 20; y <= 28; y++) {
for (let z = 0; z <= 6; z++) {
const dy = y - 24, dz = z - 2.5;
if (dy * dy + dz * dz <= 7.4) set(x, y, z, woodShade(x, y, z));
}
}
}
// ---------- butt cap ----------
sphere(4, 24, 3, 3.3, WM);
for (let x = 1; x <= 7; x++)
for (let y = 19; y <= 29; y++)
for (let z = 0; z <= 7; z++)
if (get(x, y, z)) set(x, y, z, woodShade(x, y, z));
// ---------- leather grip wrap ----------
for (let x = 8; x <= 19; x++) {
if (x % 4 !== 0) continue;
for (let y = 20; y <= 28; y++) {
for (let z = 0; z <= 7; z++) {
const dy = y - 24, dz = z - 2.5, d2 = dy * dy + dz * dz;
if (d2 > 5.2 && d2 <= 11.5) set(x, y, z, d2 > 8.5 ? LEA_D : LEA);
}
}
}
// ---------- flared brass collar ----------
const collarR2 = [8.5, 12, 15.5, 19, 22];
for (let i = 0; i < 5; i++) {
const x = 27 + i, r2 = collarR2[i];
for (let y = 17; y <= 31; y++) {
for (let z = 0; z <= 12; z++) {
const dy = y - 24, dz = z - 2.5, d2 = dy * dy + dz * dz;
if (d2 > r2) continue;
let c;
if (x === 28 || x === 30) c = (d2 > r2 - 4) ? BRS_L : BRS;
else c = (d2 > r2 - 5) ? BRS_D : woodShade(x, y, z);
set(x, y, z, c);
}
}
}
// ---------- glowing orb ----------
part("orb");
for (let x = 30; x <= 44; x++) {
for (let y = 17; y <= 31; y++) {
for (let z = 0; z <= 14; z++) {
const dx = x - 37, dy = y - 24, dz = z - 7;
const d2 = dx * dx + dy * dy + dz * dz;
if (d2 > 49) continue;
const v = (-dz * 0.055 - dy * 0.022 + dx * 0.012) + (rand() - 0.5) * 0.32;
let c;
if (v > 0.30) c = "#ccf9ff";
else if (v > 0.03) c = "#7fe4f7";
else if (v > -0.28) c = "#3cbcd8";
else c = "#1a7f9c";
set(x, y, z, c);
}
}
}
// ---------- wooden claws holding the orb ----------
part("body");
line(29, 24, 7, 34, 24, 12, 1.2, WL);
line(34, 24, 12, 38, 24, 14, 1.0, WL);
line(38, 24, 14, 40, 24, 13, 0.8, WH);
line(29, 21, 5, 34, 18, 6, 1.2, WL);
line(34, 18, 6, 38, 17, 8, 1.0, WL);
line(29, 27, 5, 34, 30, 6, 1.2, WL);
line(34, 30, 6, 38, 31, 8, 1.0, WL);
// ---------- crackling electricity ----------
part("crackle");
line(42, 22, 11, 45, 20, 15, 0, "#e6ffff");
line(45, 20, 15, 43, 23, 18, 0, "#e6ffff");
line(43, 23, 18, 46, 21, 21, 0, "#e6ffff");
line(35, 28, 11, 33, 31, 15, 0, "#e6ffff");
line(33, 31, 15, 35, 33, 18, 0, "#e6ffff");
line(34, 20, 10, 31, 17, 13, 0, "#e6ffff");
line(31, 17, 13, 29, 19, 16, 0, "#e6ffff");
line(41, 28, 10, 44, 31, 8, 0, "#9feaff");
set(46, 25, 3, "#eaffff");
set(45, 17, 6, "#bff4ff");
set(28, 24, 9, "#eaffff");
// ---------- floating spark motes ----------
part("sparks");
set(33, 20, 19, "#eaffff");
set(34, 19, 21, "#bff4ff");
set(32, 22, 20, "#8fe8ff");
part("sparks2");
set(41, 30, 17, "#eaffff");
set(43, 32, 18, "#bff4ff");
set(40, 31, 19, "#8fe8ff");
// ---------- animation ----------
void ("sparks", { type: "bob", axis: "z", speed: 1.4, amplitude: 2.0 });
void ("sparks2", { type: "bob", axis: "z", speed: 0.95, amplitude: 1.5 });
colors("orb", { palette: ["#0e6b8a", "#1fa8cc", "#57dcf0", "#a9f2ff"], pattern: "noise", speed: 1.0, glow: 0.9 });
colors("crackle", { palette: ["#7fdcf2", "#c8f8ff", "#eaffff", "#5cd8f0"], pattern: "flicker", speed: 2.6, glow: 1.0 });
colors("sparks", { palette: ["#8fe8ff", "#eaffff"], pattern: "flicker", speed: 3.0, glow: 1.0 });
colors("sparks2", { palette: ["#8fe8ff", "#eaffff"], pattern: "flicker", speed: 2.2, glow: 1.0 });import { draw } from "./assets/voxel";
import { armaRayo } from "./assets/arma-rayo";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, armaRayo, 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 arma-rayo
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["arma-rayo"] })
# It lands in client/assets/arma-rayo.ts
# https://fogon.page/object/arma-rayo