fogón

← BásicoObjeto 3Dfogon/lampara-de-pie-tripode

Lámpara de pie trípode

de fogonCC03214 bloques
Lámpara de pie trípodeArrastrá para girarlo
// «Lámpara de pie trípode» · gpt-6-sol (medium)
// Tripod floor lamp («Lámpara de pie trípode»).

// Tripod legs: warm, faceted wood with dark feet.
const woodDark = "#644026";
const woodMid = "#88552f";
const woodLight = "#ae7440";

function leg(x1, y1) {
  line(24, 24, 25, x1, y1, 1, 1.65, woodDark);
  line(24, 23, 25, x1, y1 - 1, 2, 0.75, woodMid);
  line(24, 23, 24, x1, y1 - 1, 3, 0, woodLight);
  box(x1 - 1, y1 - 1, 0, x1 + 1, y1 + 1, 1, "#4a3528");
}

leg(24, 39); // rear leg
leg(9, 12);
leg(39, 12);

// The three wooden struts meet beneath the shade.
cylinder(24, 24, 21, 2, 5, "#563c2a");
cylinder(24, 24, 23, 1.5, 3, "#a77342");
box(22, 22, 21, 26, 26, 22, "#44372c");

// Hollow, gently flared woven shade.
const TAU = Math.PI * 2;
function frac(v) { return v - Math.floor(v); }

for (let z = 25; z <= 41; z++) {
  const height = (z - 25) / 15;
  const rx = 18 - 3.1 * height;
  const ry = 14 - 2.3 * height;

  for (let x = 5; x <= 43; x++) {
    for (let y = 8; y <= 40; y++) {
      const dx = x - 24, dy = y - 24;
      const radial = Math.sqrt((dx / rx) ** 2 + (dy / ry) ** 2);
      const angle = Math.atan2(dy / ry, dx / rx);
      const around = angle * 17 / TAU;

      // Two sets of diagonal, crossing strips leave open diamond-shaped gaps.
      const weaveA = frac(around + z * 0.31) < 0.34;
      const weaveB = frac(around - z * 0.31) < 0.34;
      const horizontal = z === 25 || z === 26 || z === 39 || z === 40;
      const narrowBand = (z === 30 || z === 35) && frac(around * 0.54) < 0.69;

      if (z <= 40 && radial >= 0.925 && radial <= 1.055 &&
          (weaveA || weaveB || horizontal || narrowBand)) {
        let color;
        if (z >= 39) color = rand() < 0.24 ? "#f1e9d5" : "#e1d8bd";
        else if (dy < -2) {
          color = rand() < 0.18 ? "#f0e8d2"
                : rand() < 0.38 ? "#d4c8aa" : "#e4dac1";
        } else {
          color = rand() < 0.28 ? "#c2b597" : "#d8ccb0";
        }
        set(x, y, z, color);
      }

      // Recessed inner wall is visible through the open top.
      if (z >= 35 && z <= 39 && dy >= 0 &&
          radial >= 0.82 && radial < 0.925) {
        set(x, y, z, z >= 38 ? "#aa9c80" : "#b8a98c");
      }

      // A thick, irregular light-colored rim around the opening.
      if (z === 41 && radial >= 0.87 && radial <= 1.035 &&
          (rand() > 0.12 || dy < 0)) {
        set(x, y, z, rand() < 0.27 ? "#d2c5a8" : "#eee5cf");
      }
    }
  }
}