228

Superformula Bloom

Johan Gielis' 2D superformula generalization of the superellipse, producing complex biological flora geometries through harmonic powers.

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

Full Executable Algorithm Code

// 003 - Superformula Bloom (organic)
// 1:1 Original algorithm engine source
function createSuperformulaBloom() {
  return {
    setup() {
    },
    render(context, timeState, params) {
      const { ctx, width, height } = context;
      const t = timeState.time * Number(params.speed || 0.8);
      const m = Number(params.symmetry || 6) + Math.sin(t * 0.5) * 2;
      const n1 = Number(params.form1 || 0.3) + Math.sin(t * 0.8) * 0.15;
      const n2 = Number(params.form2 || 1.7) + Math.cos(t * 0.6) * 0.5;
      const n3 = Number(params.form3 || 1.7) + Math.sin(t * 0.7) * 0.5;
      const a = 1;
      const b = 1;
      ctx.fillStyle = "rgba(8, 9, 13, 0.2)";
      ctx.fillRect(0, 0, width, height);
      const cx = width * 0.5;
      const cy = height * 0.5;
      const scale = Math.min(width, height) * 0.32;
      const steps = 720;
      for (let layer = 0; layer < 4; layer++) {
        const layerScale = scale * (1 - layer * 0.22);
        const layerOffset = layer * 0.4 + t * 0.3;
        ctx.beginPath();
        for (let i = 0; i <= steps; i++) {
          const phi = i / steps * Math.PI * 2;
          const part1 = Math.pow(Math.abs(Math.cos(m * phi / 4) / a), n2);
          const part2 = Math.pow(Math.abs(Math.sin(m * phi / 4) / b), n3);
          const r = Math.pow(part1 + part2, -1 / n1);
          const px = cx + r * layerScale * Math.cos(phi + layerOffset);
          const py = cy + r * layerScale * Math.sin(phi + layerOffset);
          if (i === 0) ctx.moveTo(px, py);
          else ctx.lineTo(px, py);
        }
        ctx.closePath();
        const hue = (layer * 50 + t * 30 + 300) % 360;
        ctx.strokeStyle = hsla(hue, 85, 65, 0.7);
        ctx.lineWidth = 2 - layer * 0.3;
        ctx.stroke();
      }
    }
  };
}

// Default parameters from content metadata
const defaultParams = [
  {
    "key": "symmetry",
    "label": "Rotational Symmetry (m)",
    "type": "range",
    "min": 2,
    "max": 16,
    "step": 1,
    "defaultValue": 6,
    "description": "Number of morphological petals"
  },
  {
    "key": "form1",
    "label": "Curvature Exponent (n1)",
    "type": "range",
    "min": 0.1,
    "max": 1,
    "step": 0.05,
    "defaultValue": 0.3,
    "description": "Overall boundary sharpness"
  },
  {
    "key": "speed",
    "label": "Morph Speed",
    "type": "range",
    "min": 0.2,
    "max": 2,
    "step": 0.1,
    "defaultValue": 0.8,
    "description": "Rate of dimensional oscillation"
  }
];

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

const instance = window.__art_instances['superformula-bloom'];
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
r(ϕ)=(cos(mϕ/4)an2+sin(mϕ/4)bn3)1n1r(\phi) = \left( \left|\frac{\cos(m\phi/4)}{a}\right|^{n_2} + \left|\frac{\sin(m\phi/4)}{b}\right|^{n_3} \right)^{-\frac{1}{n_1}}
Click to expand
Compact Formula
r = (|cos(m*φ/4)/a|^n2 + |sin(m*φ/4)/b|^n3)^(-1/n1)

Mathematical Tags

#gielis #superformula #geometry #flower #polar #morphology
Author: Math Art Core Target: 60 FPS

Export & Embed: Superformula Bloom

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/superformula-bloom" 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! ✨