438

Phyllotaxis Spiral

Botanical sunflower spiral generated by the golden angle divergence formula theta = n * 137.508 degrees, scaling dynamically with radial distance.

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

Full Executable Algorithm Code


import type { ArtRenderer, ParameterState, RenderContext, TimeState } from '../../types/engine';
import { hsla } from '../common/color';

export function createPhyllotaxisSpiral(): ArtRenderer {
  return {
    setup() {},

    render(context: RenderContext, timeState: TimeState, params: ParameterState) {
      const { ctx, width, height } = context;
      const count = Number(params.pointCount || 1200);
      const c = Number(params.scaleFactor || 6.0);
      const speed = Number(params.rotationSpeed || 0.5);
      const divergence = Number(params.divergenceAngle || 137.508) * (Math.PI / 180);

      ctx.fillStyle = '#08090d';
      ctx.fillRect(0, 0, width, height);

      const cx = width * 0.5;
      const cy = height * 0.5;
      const t = timeState.time * speed;

      for (let n = 0; n < count; n++) {
        const theta = n * divergence + t * (1 + n * 0.0002);
        const r = c * Math.sqrt(n) * (1 + 0.05 * Math.sin(t * 2 + n * 0.02));

        const x = cx + r * Math.cos(theta);
        const y = cy + r * Math.sin(theta);

        if (x < -20 || x > width + 20 || y < -20 || y > height + 20) continue;

        const size = Math.max(1, (r / (width * 0.5)) * 4 + 1.2);
        const hue = (n * 0.35 + t * 40) % 360;

        ctx.fillStyle = hsla(hue, 90, 65, 0.85);
        ctx.beginPath();
        ctx.arc(x, y, size, 0, Math.PI * 2);
        ctx.fill();
      }
    },
  };
}
Edit in Interactive Playground Zero Dependencies • Standalone Canvas 2D
ƒ

Mathematical Formulation

low
Analytical Equation
θn=n⋅137.507764∘,rn=cn\theta_n = n \cdot 137.507764^{\circ}, \quad r_n = c \sqrt{n}
Click to expand
Compact Formula
θ = n * 137.508°, r = c * √n, x = r * cos(θ + t), y = r * sin(θ + t)

Mathematical Tags

#golden-ratio #fibonacci #phyllotaxis #spiral #botany #polar
Author: Math Art Core Target: 60 FPS

Export & Embed: Phyllotaxis Spiral

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/phyllotaxis-spiral" width="500" height="500" frameborder="0" loading="lazy"></iframe>
ESC
↑↓ Navigate ↵ Select
113 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! ✨