228

Bioluminescent Jellyfish

Marine cnidarian hydrostatic locomotion modeled via periodic radial bell contractions and multi-node sinusoidal wave propagation down trailing tentacles.

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

Full Executable Algorithm Code

// 026 - Bioluminescent Jellyfish (creatures)
// 1:1 Original algorithm engine source
function createBioluminescentJellyfish() {
  const BELL_RIBBONS = 48;
  const TENTACLES = 96;
  const NODES_PER_TENTACLE = 36;
  return {
    setup() {
    },
    render(context, timeState, params) {
      const { ctx, width, height } = context;
      const speed = Number(params.pulseSpeed || 1.1);
      const tentacleLength = Number(params.tentacleLength || 200);
      const glowIntensity = Number(params.glowIntensity || 1.3);
      const t = timeState.time * speed;
      ctx.fillStyle = "#020307";
      ctx.fillRect(0, 0, width, height);
      const cx = width * 0.5 + Math.sin(t * 0.4) * (width * 0.05);
      const cy = height * 0.4 + Math.sin(t * 1.4) * 12;
      const baseR = Math.min(width, height) * 0.23;
      const pulse = 1 + 0.22 * Math.sin(t * 2.8);
      const contraction = Math.max(0, -Math.sin(t * 2.8));
      ctx.save();
      ctx.translate(cx, cy);
      ctx.globalCompositeOperation = "screen";
      const baseHue = (185 + Math.sin(t * 0.6) * 25) % 360;
      for (let r = 0; r < BELL_RIBBONS; r++) {
        const normR = (r + 1) / BELL_RIBBONS;
        const ribbonR = baseR * normR;
        const domeH = ribbonR * 1.12 * pulse;
        const domeW = ribbonR * (1.22 / pulse);
        ctx.beginPath();
        const steps = 80;
        for (let i = 0; i <= steps; i++) {
          const phi = i / steps * Math.PI;
          const frill1 = Math.sin(phi * 8 + t * 3 + normR * 4) * (0.04 * normR);
          const frill2 = Math.cos(phi * 16 - t * 2) * (0.02 * normR);
          const scallop = Math.sin(phi * 8) * (8 * normR * pulse);
          const px = Math.cos(phi) * domeW * (1 + frill1 + frill2);
          const py = -Math.sin(phi) * domeH + scallop * (normR > 0.85 ? 1 : 0);
          if (i === 0) ctx.moveTo(px, py);
          else ctx.lineTo(px, py);
        }
        const ribbonHue = (baseHue + normR * 35) % 360;
        const alpha = (0.08 + normR * 0.35 + contraction * 0.2) * glowIntensity;
        ctx.strokeStyle = hsla(ribbonHue, 95, 65 + normR * 15, alpha);
        ctx.lineWidth = normR > 0.9 ? 1.8 : 0.8;
        ctx.stroke();
      }
      for (let ring = 1; ring <= 12; ring++) {
        const normRing = ring / 12;
        const rw = baseR * 1.15 * normRing * (1 / pulse);
        const rh = baseR * 0.55 * normRing * pulse;
        const ry = -baseR * 0.9 * (1 - normRing) * pulse;
        ctx.beginPath();
        ctx.ellipse(0, ry, rw, rh, 0, 0, Math.PI * 2);
        ctx.strokeStyle = hsla((baseHue + 40) % 360, 90, 75, (0.12 + contraction * 0.25) * glowIntensity);
        ctx.lineWidth = 1;
        ctx.stroke();
      }
      for (let g = 0; g < 4; g++) {
        const gAngle = g / 4 * Math.PI * 2 + Math.PI * 0.25;
        const gDist = baseR * 0.42 * (1 / pulse);
        const gx = Math.cos(gAngle) * gDist;
        const gy = -baseR * 0.48 * pulse + Math.sin(gAngle) * (gDist * 0.5);
        ctx.save();
        ctx.translate(gx, gy);
        ctx.rotate(gAngle + Math.PI * 0.5);
        for (let h = 1; h <= 4; h++) {
          const hr = (4 + h * 3) * pulse;
          ctx.beginPath();
          ctx.arc(0, 0, hr, 0.2 * Math.PI, 1.8 * Math.PI);
          ctx.strokeStyle = hsla(325 + h * 8, 100, 75, (0.5 - h * 0.08) * glowIntensity);
          ctx.lineWidth = 1.4;
          ctx.stroke();
        }
        ctx.fillStyle = hsla(340, 100, 90, 0.95);
        ctx.beginPath();
        ctx.arc(0, 0, 3 * pulse, 0, Math.PI * 2);
        ctx.fill();
        ctx.restore();
      }
      for (let r = 0; r < 8; r++) {
        const rPhi = r / 8 * Math.PI;
        const rx = Math.cos(rPhi) * (baseR * 1.22 / pulse);
        const ry = Math.sin(rPhi * 8) * 8 * pulse;
        ctx.fillStyle = "#38bdf8";
        ctx.shadowColor = "#38bdf8";
        ctx.shadowBlur = 10;
        ctx.beginPath();
        ctx.arc(rx, ry, 2.5, 0, Math.PI * 2);
        ctx.fill();
        ctx.shadowBlur = 0;
      }
      for (let a = 0; a < 32; a++) {
        const normA = a / 31;
        const armSide = (normA - 0.5) * 2;
        const armRootX = armSide * (baseR * 0.28);
        const armRootY = -baseR * 0.15;
        ctx.beginPath();
        ctx.moveTo(armRootX, armRootY);
        const armSteps = 45;
        const armLen = tentacleLength * 0.95;
        for (let s = 1; s <= armSteps; s++) {
          const ns = s / armSteps;
          const w1 = Math.sin(ns * 12 + t * 4 + a * 0.3) * (24 * ns * (1 + Math.abs(armSide)));
          const w2 = Math.cos(ns * 24 - t * 3 + a * 0.5) * (10 * ns);
          const w3 = Math.sin(t * 1.8 + ns * 6) * (32 * ns * armSide);
          const ax = armRootX + w1 + w2 + w3;
          const ay = armRootY + ns * armLen;
          ctx.lineTo(ax, ay);
        }
        const armHue = (baseHue + 50 + normA * 45) % 360;
        ctx.strokeStyle = hsla(armHue, 95, 78, 0.45 * glowIntensity);
        ctx.lineWidth = 1.1;
        ctx.stroke();
      }
      for (let k = 0; k < TENTACLES; k++) {
        const normK = k / (TENTACLES - 1);
        const phi = normK * Math.PI;
        const rootX = Math.cos(phi) * (baseR * 1.2 / pulse);
        const rootY = Math.sin(phi * 8) * 8 * pulse;
        ctx.beginPath();
        ctx.moveTo(rootX, rootY);
        for (let n = 1; n <= NODES_PER_TENTACLE; n++) {
          const normN = n / NODES_PER_TENTACLE;
          const dist = normN * tentacleLength * (1 + 0.2 * Math.sin(t * 1.8 + k * 0.2));
          const wave1 = Math.sin(t * 3.5 - normN * 8 + k * 0.35) * (26 * normN);
          const wave2 = Math.cos(t * 2 + normN * 14 - k * 0.2) * (12 * normN);
          const drift = Math.sin(t * 0.9) * (normN * 22);
          const tx = rootX + wave1 + wave2 + drift;
          const ty = rootY + dist;
          ctx.lineTo(tx, ty);
          if (n % 8 === 0 && k % 3 === 0) {
            ctx.fillStyle = hsla((baseHue + k * 4) % 360, 100, 88, 0.85 * glowIntensity);
            ctx.fillRect(tx - 1, ty - 1, 2.2, 2.2);
          }
        }
        const tentHue = (baseHue - 20 + normK * 50 + t * 15) % 360;
        const tentAlpha = (k % 4 === 0 ? 0.65 : 0.25) * glowIntensity;
        ctx.strokeStyle = hsla(tentHue, 95, 75, tentAlpha);
        ctx.lineWidth = k % 4 === 0 ? 1.4 : 0.7;
        ctx.stroke();
      }
      ctx.restore();
    }
  };
}

// Default parameters from content metadata
const defaultParams = [
  {
    "key": "pulseSpeed",
    "label": "Pulse Stroke Rate",
    "type": "range",
    "min": 0.5,
    "max": 2.5,
    "step": 0.1,
    "defaultValue": 1.2,
    "description": "Swimming bell contraction velocity"
  },
  {
    "key": "tentacleLength",
    "label": "Tentacle Reach",
    "type": "range",
    "min": 80,
    "max": 260,
    "step": 10,
    "defaultValue": 160,
    "description": "Length of trailing cnidocyte tentacles"
  },
  {
    "key": "glowIntensity",
    "label": "Bioluminescent Glow",
    "type": "range",
    "min": 0.2,
    "max": 2,
    "step": 0.1,
    "defaultValue": 1,
    "description": "Luciferin photonic emission level"
  }
];

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

const instance = window.__art_instances['bioluminescent-jellyfish'];
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

high
Analytical Equation
R(θ,t)=R0[1+Asin(ωt)cos(nθ)],ytentacle(s,t)=s+Atsin(ksωt)R(\theta, t) = R_0 \left[ 1 + A \sin(\omega t) \cos(n \theta) \right], \quad y_{\text{tentacle}}(s, t) = s + A_t \sin(k s - \omega t)
Click to expand
Compact Formula
r_dome = R*(1 + 0.22*sin(3t)), y_tentacle = y0 + s + sin(3t - 6s + k)*18s

Mathematical Tags

#jellyfish #marine #creatures #bioluminescence #kinematics #waves
Author: Math Art Core Target: 60 FPS

Export & Embed: Bioluminescent Jellyfish

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/bioluminescent-jellyfish" 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! ✨