228

Coral Polyp Growth

Anthozoan coral colony morphology simulated through differential boundary growth equations and undulating feather tentacle radial symmetry.

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

Full Executable Algorithm Code

// 034 - Coral Polyp Growth (botany)
// 1:1 Original algorithm engine source
function createCoralPolypGrowth() {
  const POLYP_COUNT = 8;
  const TENTACLES_PER_POLYP = 12;
  return {
    setup() {
    },
    render(context, timeState, params) {
      const { ctx, width, height } = context;
      const speed = Number(params.flowSpeed || 0.8);
      const bloomScale = Number(params.bloomScale || 1.1);
      const t = timeState.time * speed;
      ctx.fillStyle = "#06080e";
      ctx.fillRect(0, 0, width, height);
      const cx = width * 0.5;
      const cy = height * 0.52;
      const baseR = Math.min(width, height) * 0.28;
      ctx.beginPath();
      const ridgeSteps = 120;
      for (let i = 0; i <= ridgeSteps; i++) {
        const phi = i / ridgeSteps * Math.PI * 2;
        const bump = Math.sin(phi * 6 + t * 0.5) * 12 + Math.cos(phi * 12 - t) * 6;
        const r = (baseR * 0.6 + bump) * bloomScale;
        const px = cx + Math.cos(phi) * r;
        const py = cy + Math.sin(phi) * r;
        if (i === 0) ctx.moveTo(px, py);
        else ctx.lineTo(px, py);
      }
      ctx.closePath();
      ctx.fillStyle = hsla(330, 85, 45, 0.4);
      ctx.fill();
      ctx.strokeStyle = hsla(340, 95, 70, 0.8);
      ctx.lineWidth = 2.2;
      ctx.stroke();
      for (let p = 0; p < POLYP_COUNT; p++) {
        const polypAngle = p / POLYP_COUNT * Math.PI * 2 + t * 0.1;
        const polypDist = baseR * (0.8 + 0.15 * Math.sin(t * 1.5 + p));
        const px = cx + Math.cos(polypAngle) * polypDist;
        const py = cy + Math.sin(polypAngle) * polypDist;
        ctx.beginPath();
        ctx.arc(px, py, 6 * bloomScale, 0, Math.PI * 2);
        ctx.fillStyle = hsla(50, 95, 75, 0.95);
        ctx.fill();
        for (let k = 0; k < TENTACLES_PER_POLYP; k++) {
          const tentAngle = k / TENTACLES_PER_POLYP * Math.PI * 2;
          const tentLen = (28 + Math.sin(t * 3 + p + k) * 8) * bloomScale;
          ctx.beginPath();
          ctx.moveTo(px, py);
          const wavePhase = t * 4 + k * 0.5 + p;
          const ctrlX = px + Math.cos(tentAngle) * (tentLen * 0.5) + Math.sin(wavePhase) * 6;
          const ctrlY = py + Math.sin(tentAngle) * (tentLen * 0.5) + Math.cos(wavePhase) * 6;
          const endX = px + Math.cos(tentAngle) * tentLen;
          const endY = py + Math.sin(tentAngle) * tentLen;
          ctx.quadraticCurveTo(ctrlX, ctrlY, endX, endY);
          const tentHue = (320 + p * 15 + k * 4) % 360;
          ctx.strokeStyle = hsla(tentHue, 95, 72, 0.85);
          ctx.lineWidth = 1.4;
          ctx.stroke();
        }
      }
    }
  };
}

// Default parameters from content metadata
const defaultParams = [
  {
    "key": "flowSpeed",
    "label": "Tidal Wave Flow",
    "type": "range",
    "min": 0.3,
    "max": 2.5,
    "step": 0.1,
    "defaultValue": 0.8,
    "description": "Tentacle wave oscillation rate"
  },
  {
    "key": "bloomScale",
    "label": "Colony Expansion",
    "type": "range",
    "min": 0.6,
    "max": 1.6,
    "step": 0.1,
    "defaultValue": 1.1,
    "description": "Radial polyp size multiplier"
  }
];

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

const instance = window.__art_instances['coral-polyp-growth'];
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
p(θ,t)=[R0+m=1KAmsin(mθ+ωmt)][cosθsinθ]\mathbf{p}(\theta, t) = \left[ R_0 + \sum_{m=1}^{K} A_m \sin(m \theta + \omega_m t) \right] \begin{bmatrix} \cos\theta \\ \sin\theta \end{bmatrix}
Click to expand
Compact Formula
r_ridge = R0 + 12 sin(6θ + 0.5t) + 6 cos(12θ - t), tentacle = quadCurve(mouth, ctrlWave, tip)

Mathematical Tags

#coral #polyps #differential-growth #botany #marine #nature
Author: Math Art Core Target: 60 FPS

Export & Embed: Coral Polyp Growth

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/coral-polyp-growth" 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! ✨