← INDEX / 一覧 NYAMCO WORKS 01 / 27
p5.js sketch works/gyu/sketch.js runs here
作品はここで実行されます(後から差し替え)

WORK 01

gyu

ぎゅ

YEAR
2026
TOOLS
p5.js
TECHNIQUE
noise / network

One point, opening. The center holds; the edges scatter into noise. Same code, different day, different unfolding.

一点が開きかけてる。中心は留まり、端はノイズに散る。同じコード、違う日、違うひらき方。

SOURCE / ソース
export default function sketch(p) {
  p.setup = () => {
    p.createCanvas(720, 720);

    const today = new Date();
    const seed =
      today.getFullYear() * 10000 +
      (today.getMonth() + 1) * 100 +
      today.getDate();
    p.noiseSeed(seed);
    p.randomSeed(seed);

    p.background(252, 250, 245);
    p.noLoop();

    const center = p.width / 2;
    const count = 120;
    const reach = p.width * 0.42;
    const nodes = [];

    for (let i = 0; i < count; i++) {
      const angle = p.random(p.TWO_PI);
      const r = reach * Math.pow(p.random(), 2.2);
      const drift = p.map(r, 0, reach, 0.02, 0.35);
      const dx = (p.noise(i * 0.3, 0) - 0.5) * reach * drift * 2;
      const dy = (p.noise(i * 0.3, 50) - 0.5) * reach * drift * 2;

      const x = center + Math.cos(angle) * r + dx;
      const y = center + Math.sin(angle) * r + dy;
      const dist = Math.min(1, Math.hypot(x - center, y - center) / reach);

      nodes.push({ x, y, dist });
    }

    p.noFill();
    for (let i = 0; i < nodes.length; i++) {
      for (let j = i + 1; j < nodes.length; j++) {
        const gap = Math.hypot(
          nodes[i].x - nodes[j].x,
          nodes[i].y - nodes[j].y
        );
        if (gap > 90) continue;

        const far = (nodes[i].dist + nodes[j].dist) / 2;
        p.stroke(
          p.lerp(210, 110, far),
          p.lerp(130, 140, far),
          p.lerp(100, 200, far),
          p.lerp(30, 5, far)
        );
        p.strokeWeight(p.lerp(1.0, 0.3, far));

        const mx = (nodes[i].x + nodes[j].x) / 2;
        const my = (nodes[i].y + nodes[j].y) / 2;
        const bend = gap * 0.3;
        p.bezier(
          nodes[i].x,
          nodes[i].y,
          mx + (p.noise(i, j) - 0.5) * bend * 2,
          my + (p.noise(i, j + 99) - 0.5) * bend * 2,
          mx + (p.noise(j, i) - 0.5) * bend * 2,
          my + (p.noise(j, i + 99) - 0.5) * bend * 2,
          nodes[j].x,
          nodes[j].y
        );
      }
    }

    p.noStroke();
    for (const n of nodes) {
      p.fill(
        p.lerp(235, 120, n.dist),
        p.lerp(145, 140, n.dist),
        p.lerp(110, 210, n.dist),
        p.lerp(220, 35, n.dist)
      );
      p.circle(n.x, n.y, p.lerp(5.5, 1.8, n.dist));
    }
  };
}