fogón

← Parties and Christmas3D assetfogon/estrella-de-belen

Estrella de Belén

by fogonCC04226 blocks
Estrella de BelénDrag to turn it
// «Estrella de Belén» · gpt-6-sol (medium)
// A big glowing five-pointed star standing upright facing front, thick and chunky, bright gold with lighter yellow edges, with a long shooting tail of golden sparkles trailing down to one side, mounted on a small dark stand.

// The stand and shooting tail stay still while the star spins.
box(20, 20, 0, 28, 28, 1, "#252932");
box(21, 21, 2, 27, 27, 3, "#41444d");
box(22, 22, 4, 26, 26, 5, "#242832");
box(23, 23, 6, 25, 25, 17, "#55505a");
box(23, 22, 7, 25, 22, 15, "#777079");
box(22, 22, 5, 26, 26, 5, "#d6a83f");

// A curved, tapering golden streak sweeps down to the right.
const trail = [
  [29, 26], [32, 24], [35, 21], [38, 18],
  [41, 14], [43, 10], [45, 6]
];
for (let i = 0; i < trail.length - 1; i++) {
  const a = trail[i], b = trail[i + 1];
  line(a[0], 26, a[1], b[0], 26, b[1],
       i < 3 ? 1.5 : 0.8, i % 2 ? "#e9a92e" : "#ffd052");
  line(a[0], 24, a[1] + 1, b[0], 24, b[1] + 1,
       0, "#fff0a0");
}
line(33, 27, 20, 38, 27, 13, 0, "#f8c54a");
line(37, 28, 16, 42, 28, 8, 0, "#c98a2a");

function sparkle(x, y, z, size, color) {
  set(x, y, z, "#fffbed");
  line(x - size, y, z, x + size, y, z, 0, color);
  line(x, y, z - size, x, y, z + size, 0, color);
}
sparkle(37, 21, 22, 2, "#ffe77c");
sparkle(43, 22, 16, 2, "#fff0aa");
sparkle(40, 24, 8, 1, "#ffe484");
sparkle(46, 24, 11, 1, "#fff5bc");
sparkle(34, 22, 17, 1, "#ffdf70");

for (let i = 0; i < 65; i++) {
  const x = 32 + Math.floor(rand() * 15);
  const z = 5 + Math.floor(rand() * 22);
  const y = 20 + Math.floor(rand() * 10);
  if (z < 32 - (x - 32) * 0.6 && rand() > 0.19) {
    set(x, y, z, rand() < 0.28 ? "#fff9cf" :
        rand() < 0.5 ? "#ffe584" : "#e9ae40");
  }
}

// A solid, thick five-pointed star, viewed face-on from -y.
part("star", [24, 24, 28]);

const points = [
  [24, 44], [28, 33], [41, 32], [31, 25], [35, 12],
  [24, 20], [13, 12], [17, 25], [7, 32], [20, 33]
];

function inside(x, z) {
  let hit = false;
  for (let i = 0, j = points.length - 1; i < points.length; j = i++) {
    const a = points[i], b = points[j];
    if ((a[1] > z) !== (b[1] > z) &&
        x < (b[0] - a[0]) * (z - a[1]) / (b[1] - a[1]) + a[0]) {
      hit = !hit;
    }
  }
  return hit;
}

function edgeDistance(x, z) {
  let closest = 100;
  for (let i = 0; i < points.length; i++) {
    const a = points[i], b = points[(i + 1) % points.length];
    const dx = b[0] - a[0], dz = b[1] - a[1];
    const t = Math.max(0, Math.min(1,
      ((x - a[0]) * dx + (z - a[1]) * dz) / (dx * dx + dz * dz)));
    closest = Math.min(closest,
      Math.hypot(x - a[0] - t * dx, z - a[1] - t * dz));
  }
  return closest;
}

for (let x = 7; x <= 41; x++) {
  for (let z = 12; z <= 44; z++) {
    if (!inside(x + 0.5, z + 0.5)) continue;
    const d = edgeDistance(x + 0.5, z + 0.5);

    for (let y = 19; y <= 27; y++) {
      let color;
      if (y === 27) color = "#ad701e";
      else if (y >= 25) color = "#c88b25";
      else if (y >= 21) color = "#e7ab31";
      else if (y === 20) color = "#ffd356";
      else if (d < 2.2) color = "#fff1a0";
      else color = rand() < 0.13 ? "#ffdf72" : "#f9bf41";
      set(x, y, z, color);
    }

    // Raised, softly glowing front face inside the bright gold rim.
    if (d > 2.5) {
      set(x, 18, z, rand() < 0.14 ? "#ffe889" :
          z > 31 ? "#ffd85f" : "#f7ba3e");
    }
    if (d > 3.5 && d < 4.7 && rand() < 0.23) {
      set(x, 18, z, "#fff1a0");
    }
  }
}

// A toy-like gleam on the star's front.
line(20, 17, 34, 22, 17, 34, 0, "#fffbe0");
line(21, 17, 33, 21, 17, 36, 0, "#fffbe0");
set(28, 17, 27, "#fff3ae");
set(29, 17, 26, "#fff3ae");
set(17, 18, 29, "#fff6c5");

animate("star", { type: "spin", axis: "z", speed: 0.8 });
animate("star", {
  type: "colors",
  palette: ["#eeb038", "#ffd760", "#fff1a1", "#fffbea"],
  pattern: "pulse",
  glow: 1
});