fogón

← NaturalezaObjeto 3Dfogon/sauce-lloron

Sauce llorón

de fogonCC018313 bloques
Sauce llorónArrastrá para girarlo
// «Sauce llorón» · gpt-6-sol (medium)
// A weeping willow: a thick twisted brown trunk with a wide dome crown from which long curtains of light green leafy strands hang all the way down almost to the ground, forming a soft umbrella shape.

const bark = "#946033";
const barkLight = "#b57a42";
const barkDark = "#674025";
const leafDark = "#5da83a";
const leafMid = "#78c747";
const leafLight = "#9bdc60";
const leafSun = "#b4e879";

// Thick, slightly wandering trunk.
const trunk = [
  [24, 24, 0], [25, 24, 7], [26, 23, 12],
  [23, 25, 19], [24, 24, 27]
];
for (let i = 0; i < trunk.length - 1; i++) {
  line(...trunk[i], ...trunk[i + 1], i < 2 ? 4 : 3, bark);
}
ellipsoid(24, 24, 3, 5, 5, 4, bark);
sphere(26, 23, 12, 3, barkLight);
sphere(23, 25, 19, 3, bark);

// Flared roots grip the ground.
for (let i = 0; i < 8; i++) {
  const a = i * Math.PI / 4;
  const reach = 7 + (i % 3);
  line(24 + Math.cos(a) * 2, 24 + Math.sin(a) * 2, 4,
       24 + Math.cos(a) * reach, 24 + Math.sin(a) * reach, 0,
       2, i % 3 === 0 ? barkLight : bark);
}

// Spiraling grooves make the trunk read as twisted bark.
for (let z = 2; z <= 25; z++) {
  let cx, cy;
  if (z <= 7) {
    cx = 24 + z / 7; cy = 24;
  } else if (z <= 12) {
    cx = 25 + (z - 7) / 5; cy = 24 - (z - 7) / 5;
  } else if (z <= 19) {
    cx = 26 - 3 * (z - 12) / 7; cy = 23 + 2 * (z - 12) / 7;
  } else {
    cx = 23 + (z - 19) / 8; cy = 25 - (z - 19) / 8;
  }
  for (let g = 0; g < 3; g++) {
    const a = z * 0.31 + g * Math.PI * 2 / 3;
    const r = z < 12 ? 4 : 3;
    set(cx + Math.cos(a) * r, cy + Math.sin(a) * r, z,
        z % 5 === 0 ? barkLight : barkDark);
  }
}

// The branches, canopy, and hanging leaves sway together.
part("crown", [24, 24, 27]);

for (let i = 0; i < 9; i++) {
  const a = i * Math.PI * 2 / 9;
  line(24, 24, 27,
       24 + Math.cos(a) * 13, 24 + Math.sin(a) * 13, 33,
       1, i % 2 ? bark : barkLight);
}

ellipsoid(24, 24, 33, 18, 18, 6, leafDark);
ellipsoid(24, 24, 35, 18, 18, 6, leafMid);
ellipsoid(24, 24, 37, 16, 16, 5, leafLight);

// Rounded, overlapping clumps soften the outline of the umbrella.
for (let i = 0; i < 32; i++) {
  const a = i * Math.PI * 2 / 32;
  const r = 14.5 + rand() * 2;
  ellipsoid(24 + Math.cos(a) * r, 24 + Math.sin(a) * r,
            34 + rand() * 3, 3, 3, 3,
            i % 3 === 0 ? leafLight : leafMid);
}
for (let i = 0; i < 38; i++) {
  const a = rand() * Math.PI * 2;
  const r = Math.sqrt(rand()) * 14;
  sphere(24 + Math.cos(a) * r, 24 + Math.sin(a) * r,
         38 + rand() * 2, 1.4 + rand() * 0.7,
         rand() < 0.55 ? leafSun : leafLight);
}

// Dappled leaves across the broad upper crown.
forEach((x, y, z, color) => {
  if ((color === leafMid || color === leafLight) && z >= 34 && rand() < 0.085) {
    set(x, y, z, z >= 38 ? leafSun : leafLight);
  }
});

// Long, uneven curtains around the rim. Their tips nearly brush the ground.
for (let i = 0; i < 84; i++) {
  const a = i * Math.PI * 2 / 84;
  const baseR = 17.2 + rand() * 1.5;
  const tip = 2 + Math.floor(rand() * 5);
  const offset = rand() * Math.PI * 2;
  for (let z = 33; z >= tip; z--) {
    const t = (33 - z) / (33 - tip);
    const r = baseR + 0.6 * Math.sin(t * Math.PI)
                  - 1.1 * t + 0.35 * Math.sin(t * 9 + offset);
    const x = 24 + Math.cos(a) * r;
    const y = 24 + Math.sin(a) * r;
    const shade = z > 27 ? leafLight :
                  z > 12 ? (i % 3 ? leafMid : leafLight) : leafMid;
    set(x, y, z, shade);
    if ((z + i) % 3 === 0) {
      sphere(x, y, z, 1, rand() < 0.24 ? leafSun : shade);
    }
    if (z > tip + 3 && z < 29 && (z + i * 3) % 9 === 0) {
      // Little leafy side sprigs break up each dangling strand.
      const side = i % 2 ? 1 : -1;
      sphere(x - Math.sin(a) * side * 1.5,
             y + Math.cos(a) * side * 1.5, z - 1,
             1, leafLight);
    }
  }
}

// Shorter inner curtains give the willow depth beneath its outer veil.
for (let i = 0; i < 43; i++) {
  const a = (i + 0.45) * Math.PI * 2 / 43;
  const radius = 11.5 + rand() * 3.5;
  const tip = 9 + Math.floor(rand() * 9);
  for (let z = 31; z >= tip; z--) {
    const t = (31 - z) / (31 - tip);
    const r = radius - t * 1.5 + Math.sin(t * 8 + i) * 0.35;
    const x = 24 + Math.cos(a) * r;
    const y = 24 + Math.sin(a) * r;
    set(x, y, z, i % 4 === 0 ? leafLight : leafMid);
    if ((z + i) % 4 === 0) sphere(x, y, z, 1, leafLight);
  }
}

animate("crown", { type: "swing", axis: "y", speed: 1.2, amplitude: 0.08 });