438

Perlin Tendrils

Particles advecting through a multi-octave Fractal Brownian Motion (FBM) gradient field, forming delicate, branching filamentous structures.

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';
import { fbm2D } from '../common/math-utils';

export function createPerlinTendrils(): ArtRenderer {
  const MAX_PARTICLES = 1500;
  const posX = new Float32Array(MAX_PARTICLES);
  const posY = new Float32Array(MAX_PARTICLES);
  const life = new Float32Array(MAX_PARTICLES);
  const maxLife = new Float32Array(MAX_PARTICLES);

  return {
    setup(context: RenderContext) {
      for (let i = 0; i < MAX_PARTICLES; i++) {
        posX[i] = Math.random() * context.width;
        posY[i] = Math.random() * context.height;
        life[i] = Math.random() * 200;
        maxLife[i] = 100 + Math.random() * 200;
      }
    },

    render(context: RenderContext, timeState: TimeState, params: ParameterState) {
      const { ctx, width, height } = context;
      const count = Math.min(MAX_PARTICLES, Number(params.particleCount || 1000));
      const speed = Number(params.speed || 1.5);
      const noiseScale = Number(params.noiseScale || 0.003);
      const t = timeState.time * 0.15;

      ctx.fillStyle = 'rgba(8, 9, 13, 0.08)';
      ctx.fillRect(0, 0, width, height);

      for (let i = 0; i < count; i++) {
        const angle = fbm2D(posX[i] * noiseScale, posY[i] * noiseScale + t) * Math.PI * 4;

        const prevX = posX[i];
        const prevY = posY[i];

        posX[i] += Math.cos(angle) * speed;
        posY[i] += Math.sin(angle) * speed;
        life[i]++;

        if (
          life[i] > maxLife[i] ||
          posX[i] < 0 ||
          posX[i] > width ||
          posY[i] < 0 ||
          posY[i] > height
        ) {
          posX[i] = Math.random() * width;
          posY[i] = Math.random() * height;
          life[i] = 0;
          continue;
        }

        const progress = life[i] / maxLife[i];
        const alpha = Math.sin(progress * Math.PI) * 0.6;
        const hue = (160 + angle * 25 + timeState.time * 10) % 360;

        ctx.beginPath();
        ctx.moveTo(prevX, prevY);
        ctx.lineTo(posX[i], posY[i]);
        ctx.strokeStyle = hsla(hue, 80, 60, alpha);
        ctx.lineWidth = 1.2;
        ctx.stroke();
      }
    },
  };
}
Edit in Interactive Playground Zero Dependencies • Standalone Canvas 2D
ƒ

Mathematical Formulation

medium
Analytical Equation
v(x,y,t)=∇×(∑i=0kγiNoise(2ix,2iy+ωt))\mathbf{v}(x, y, t) = \nabla \times \left( \sum_{i=0}^{k} \gamma^i \text{Noise}(2^i x, 2^i y + \omega t) \right)
Click to expand
Compact Formula
angle = fbm(x * 0.003, y * 0.003 + t * 0.15) * 4π, v = [cos(angle), sin(angle)]

Mathematical Tags

#perlin #fbm #noise #tendrils #flow-field #organic
Author: Math Art Core Target: 60 FPS

Export & Embed: Perlin Tendrils

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/perlin-tendrils" 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! ✨