228

Brownian Constellation

Continuous random walk nodes interconnected by proximity-based Euclidean distance thresholds, forming dynamic topological webs.

Playground
60 FPS Canvas 2D
Click + Drag to interact with field
</>

Full Executable Algorithm Code

// 011 - Brownian Constellation (particles)
// 1:1 Original algorithm engine source
function createBrownianConstellation() {
  const MAX_NODES = 160;
  const px = new Float32Array(MAX_NODES);
  const py = new Float32Array(MAX_NODES);
  const vx = new Float32Array(MAX_NODES);
  const vy = new Float32Array(MAX_NODES);
  return {
    setup(context) {
      for (let i = 0; i < MAX_NODES; i++) {
        px[i] = Math.random() * context.width;
        py[i] = Math.random() * context.height;
        vx[i] = (Math.random() - 0.5) * 1.5;
        vy[i] = (Math.random() - 0.5) * 1.5;
      }
    },
    render(context, timeState, params) {
      const { ctx, width, height } = context;
      const count = Math.min(MAX_NODES, Number(params.nodeCount || 100));
      const maxDistance = Number(params.connectionRadius || 80);
      const maxDistSq = maxDistance * maxDistance;
      const t = timeState.time;
      ctx.fillStyle = "#08090d";
      ctx.fillRect(0, 0, width, height);
      for (let i = 0; i < count; i++) {
        px[i] += vx[i];
        py[i] += vy[i];
        if (px[i] < 0 || px[i] > width) vx[i] *= -1;
        if (py[i] < 0 || py[i] > height) vy[i] *= -1;
      }
      for (let i = 0; i < count; i++) {
        for (let j = i + 1; j < count; j++) {
          const dx = px[j] - px[i];
          const dy = py[j] - py[i];
          const dSq = dx * dx + dy * dy;
          if (dSq < maxDistSq) {
            const alpha = 1 - dSq / maxDistSq;
            const hue = (190 + alpha * 80 + t * 15) % 360;
            ctx.strokeStyle = hsla(hue, 85, 60, alpha * 0.5);
            ctx.lineWidth = alpha * 1.4;
            ctx.beginPath();
            ctx.moveTo(px[i], py[i]);
            ctx.lineTo(px[j], py[j]);
            ctx.stroke();
          }
        }
        ctx.fillStyle = hsla(200, 90, 70, 0.9);
        ctx.beginPath();
        ctx.arc(px[i], py[i], 2.2, 0, Math.PI * 2);
        ctx.fill();
      }
    }
  };
}

// Default parameters from content metadata
const defaultParams = [
  {
    "key": "nodeCount",
    "label": "Constellation Nodes",
    "type": "range",
    "min": 40,
    "max": 160,
    "step": 10,
    "defaultValue": 100,
    "description": "Total walking points"
  },
  {
    "key": "connectionRadius",
    "label": "Connection Reach",
    "type": "range",
    "min": 40,
    "max": 140,
    "step": 5,
    "defaultValue": 80,
    "description": "Maximum proximity distance"
  }
];

if (!window.__art_instances) window.__art_instances = {};
if (!window.__art_instances['brownian-constellation']) {
  const inst = typeof createBrownianConstellation === 'function' ? createBrownianConstellation() : null;
  if (inst && inst.setup) {
    inst.setup({ ctx, width, height, dpr: 1, aspectRatio: width / height }, defaultParams);
  }
  window.__art_instances['brownian-constellation'] = inst;
}

const instance = window.__art_instances['brownian-constellation'];
if (instance && instance.render) {
  instance.render(
    { ctx, width, height, dpr: 1, aspectRatio: width / height },
    { time, deltaTime: dt, frameCount: Math.floor(time * 60), fps: 60 },
    defaultParams
  );
}
Edit in Interactive Playground Zero Dependencies • Standalone Canvas 2D
ƒ

Mathematical Formulation

medium
Analytical Equation
E={(i,j)pipjrconn},αij=1pipj2rconn2E = \{ (i, j) \mid \|\mathbf{p}_i - \mathbf{p}_j\| \le r_{\text{conn}} \}, \quad \alpha_{ij} = 1 - \frac{\|\mathbf{p}_i - \mathbf{p}_j\|^2}{r_{\text{conn}}^2}
Click to expand
Compact Formula
d = dist(p_i, p_j), if (d < R) drawLine(p_i, p_j, alpha = 1 - d/R)

Mathematical Tags

#graph #constellation #brownian #network #euclidean #particles
Author: Math Art Core Target: 60 FPS

Export & Embed: Brownian Constellation

4K PNG Snapshot

High-resolution single frame render

WebM Video (5s Loop)

60 FPS browser-captured stream

Standalone JS Script

Complete executable Canvas 2D algorithm

HTML Iframe Embed

<iframe src="https://art.fazleyrabbi.xyz/embed/brownian-constellation" width="500" height="500" frameborder="0" loading="lazy"></iframe>
ESC
↑↓ Navigate Select
110 Mathematical Artworks
Made by Fazley Rabbi

Support the Project

Keep mathematical creative coding alive & open source

Or via Direct Payoneer ($0 Fee)
Payoneer Customer ID: $0 Fee Direct
24076084

💡 Payoneer app: Go to Pay → Pay to recipient → Enter ID 24076084.

Thank you for supporting generative mathematical animations! ✨