← FantasíaObjeto 3Dfogon/varita
Varita mágica
Arrastrá para girarlo// «Varita mágica» · gpt-6-sol (medium)
// A magic wand standing diagonally on a small round velvet cushion of deep purple with gold tassels: a slim dark wood wand with a spiral-carved handle, a gold band, and a bright glowing five-point star tip in yellow-gold, with three tiny sparkles around the star. Make it chunky enough to read: the wand is at least 2 blocks thick and the star big.
// A velvet cushion for the wand to rest on.
ellipsoid(24, 25, 3, 13, 10, 4, "#38204f");
forEach((x, y, z, color) => {
if (color !== "#38204f") return;
if (z >= 5) set(x, y, z, rand() < 0.16 ? "#704080" : "#5b306f");
else if (z <= 1) set(x, y, z, "#291b3c");
else if (rand() < 0.08) set(x, y, z, "#48265e");
});
ellipsoid(24, 25, 5, 11, 8, 2, "#683777");
ellipsoid(23, 23, 6, 8, 5, 1, "#774382");
// Gold piping follows the rounded edge.
for (let a = 0; a < Math.PI * 2; a += 0.045) {
const x = Math.round(24 + 12.3 * Math.cos(a));
const y = Math.round(25 + 9.3 * Math.sin(a));
set(x, y, 3, "#b98335");
if (Math.sin(a) < -0.3) set(x, y, 4, "#e0ac51");
}
for (const x of [17, 24, 31]) {
set(x, 19, 6, "#d7a64d");
set(x, 18, 5, "#a7783a");
}
// Little dangling tassels along the viewer-facing edge.
for (const [x, y] of [[15, 19], [19, 16], [24, 15], [29, 16], [33, 19]]) {
sphere(x, y, 3, 1.2, "#e6b956");
set(x, y - 1, 2, "#f2cd73");
set(x, y - 1, 1, "#c6913c");
set(x, y - 1, 0, "#e0aa47");
set(x - 1, y, 1, "#a97432");
set(x + 1, y, 1, "#d9a449");
}
// The wand leans up and right, slightly in front of the cushion.
line(15, 22, 8, 33, 22, 34, 1.5, "#382323");
line(16, 21, 9, 31, 21, 31, 0, "#704536");
line(16, 23, 9, 32, 23, 32, 0, "#261b22");
// Chunky, carved grip and its rounded brass pommel.
line(15, 22, 8, 22, 22, 18, 2, "#493029");
line(16, 20, 9, 21, 20, 17, 0, "#84523a");
sphere(15, 22, 8, 2, "#aa7734");
set(14, 20, 9, "#f2c66c");
set(15, 20, 10, "#ddb051");
// A winding inlaid spiral across the grip.
for (let t = 1; t <= 11.5; t += 0.19) {
const angle = t * 1.68;
const x = 15 + t * 0.69 + 1.5 * Math.cos(angle) * 0.82;
const y = 22 + 1.8 * Math.sin(angle);
const z = 8 + t - 1.5 * Math.cos(angle) * 0.57;
set(x, y, z, Math.sin(angle) < -0.15 ? "#d9a255" : "#a96c39");
}
line(22, 22, 18, 24, 22, 21, 2.2, "#ba873e");
line(22, 20, 18, 24, 20, 21, 0, "#ffe08a");
set(23, 19, 20, "#fff0ad");
// Five-point star, cut as a thick, readable golden silhouette.
const cx = 34, cz = 36;
const points = [];
for (let i = 0; i < 10; i++) {
const angle = Math.PI / 2 + i * Math.PI / 5;
const r = i % 2 === 0 ? 8.7 : 4;
points.push([cx + r * Math.cos(angle), cz + r * Math.sin(angle)]);
}
function insideStar(x, z) {
let inside = false;
for (let i = 0, j = 9; i < 10; j = i++) {
const [xi, zi] = points[i], [xj, zj] = points[j];
if ((zi > z) !== (zj > z) &&
x < (xj - xi) * (z - zi) / (zj - zi) + xi) inside = !inside;
}
return inside;
}
function edgeDistance(x, z) {
let best = 100;
for (let i = 0; i < 10; i++) {
const [ax, az] = points[i], [bx, bz] = points[(i + 1) % 10];
const u = Math.max(0, Math.min(1,
((x - ax) * (bx - ax) + (z - az) * (bz - az)) /
((bx - ax) ** 2 + (bz - az) ** 2)));
best = Math.min(best, Math.hypot(x - ax - u * (bx - ax), z - az - u * (bz - az)));
}
return best;
}
for (let x = 24; x <= 44; x++) {
for (let z = 26; z <= 46; z++) {
if (!insideStar(x, z)) continue;
const edge = edgeDistance(x, z);
for (let y = 18; y <= 22; y++) {
let color;
if (y >= 21) color = edge < 1.2 ? "#9f6023" : "#da9230";
else if (edge < 1.15) color = "#f7ae36";
else color = y === 18 ? "#ffe55e" : "#ffd044";
set(x, y, z, color);
}
if (edge > 2.3 && Math.hypot(x - cx, z - cz) < 2.7)
set(x, 17, z, "#fff4a0");
}
}
set(33, 17, 38, "#fffbd0");
set(34, 17, 38, "#fffbd0");
set(34, 17, 37, "#fffbd0");
// Three small four-point magical sparkles.
for (const [x, y, z, size] of [[21, 18, 35, 2], [45, 18, 35, 2], [26, 18, 45, 1]]) {
set(x, y, z, "#fffbd2");
for (let d = 1; d <= size; d++) {
const c = d === 1 ? "#ffe976" : "#dca543";
set(x - d, y, z, c);
set(x + d, y, z, c);
set(x, y, z - d, c);
set(x, y, z + d, c);
}
}import { draw } from "./assets/voxel";
import { varita } from "./assets/varita";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, varita, 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 varita
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["varita"] })
# Queda en client/assets/varita.ts
# https://fogon.page/object/varita