complexification_net · fibers
Fibers (curling brush)
A field of curling fibers grown from random seeds scattered across the canvas. Each fiber walks with constant speed and a slowly oscillating curvature, branching occasionally when its age passes a maturity threshold. The result is a tapestry of bristly curls reminiscent of Tarbell's 'Main Vein' recursive growth, his 'Lichen' brushes, and the brushwork in 'substrate' and 'stitches' — the piece reads as a half-finished cloth, or a heap of synthetic hair lit obliquely. Brighter palette fibers are highlighted with light; dark fibers recede.
Original: https://web.archive.org/web/20041223174832/http://www.levitated.net/daily/levMainVein.html
▶ Try the live demo (JS port) ▶ Run reference.py via Pyodide 10 formulas have instant JS ports. The Pyodide path runs the actual Python in your browser — first load is ~6 MB, then instant.
Math essence
Each fiber integrates position via x_{t+1} = x_t + v·cos(theta_t), y_{t+1} = y_t + v·sin(theta_t), with theta_{t+1} = theta_t + k·sin(omega·t + phi). At each step there is a small Bernoulli probability of spawning `branch_max` children with mutated curvature and reduced lifetime, so the field self-similar up to its lifetime budget.
Parameters
| Name | Type | Default | Range | Description |
|---|---|---|---|---|
dim | int | 500 | 200–1000 | Square canvas side length |
num_seeds | int | 60 | 4–400 | Initial fiber seeds |
max_fibers | int | 600 | 50–4000 | Hard cap on concurrent fibers |
segment_length | float | 2.5 | 0.5–10 | Length per step in pixels |
curvature_amp | float | 0.18 | 0–1 | Amplitude of curvature oscillation |
curvature_speed_min | float | 0.005 | 0–0.5 | Min angular speed of curvature oscillation |
curvature_speed_max | float | 0.04 | 0–0.5 | Max angular speed of curvature oscillation |
speed_min | float | 0.6 | 0–5 | Min fiber speed |
speed_max | float | 1.5 | 0–5 | Max fiber speed |
branching_prob | float | 0.005 | 0–0.05 | Per-step branching probability after maturity |
branch_max | int | 4 | 0–8 | Max branches per branching event |
bg_color | tuple | 245,240,230 | null–null | Background RGB |
seed | int | null | 0–999999 | RNG seed |
Reference
First 60 lines of reference.py. Full source:
library_external/complexification_net/fibers/reference.py
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
import imageio.v2 as imageio
import numpy as np
PALETTE: np.ndarray = np.array(
[
[12, 18, 30],
[28, 36, 56],
[48, 60, 90],
[78, 92, 130],
[110, 122, 162],
[148, 152, 188],
[188, 178, 200],
[220, 200, 205],
[240, 220, 200],
[250, 232, 188],
[255, 222, 152],
[248, 200, 110],
[232, 168, 80],
[205, 130, 60],
[170, 95, 50],
[130, 70, 45],
[95, 55, 40],
[70, 42, 32],
[50, 32, 24],
[32, 22, 18],
],
dtype=np.uint8,
)
@dataclass
class _Fiber:
x: float
y: float
angle: float
curvature: float
curvature_phase: float
curvature_speed: float
speed: float
age: int = 0
life: int = 0
alive: bool = True
color: np.ndarray = field(default_factory=lambda: np.array([255, 255, 255], dtype=np.uint8))
thickness: float = 1.0
trail: list[tuple[float, float]] = field(default_factory=list)
class Fibers:
family: ClassVar[str] = "complexification_net"
sketch: ClassVar[str] = "fibers"
def __init__(
self, Try running it locally
The reference implementation is self-contained Python with numpy. Install the package and run:
python library_external/complexification_net/fibers/reference.py Need help? See Learn for the standard environment setup, or Playground for an in-browser sketchbook.
More from complexification.net
Boundaries
complexification_net · boundaries
Boundaries traces gradient-magnitude contours on a fractal Brownian motion noise substrate.
Cellular Automata Worm
complexification_net · cellularAutomataWorm
The CA Worm is an expanding construction of a one-dimensional cellular automaton.
Cyclic Cellular Automaton
complexification_net · cyclicCellularAutomaton
A Greenberg-Hastings / Rock-Paper-Scissors style cyclic cellular automaton on a 2D torus.
Diffusion Limited Aggregation
complexification_net · diffusionLimitedAggregation
DLA is a simulated growth process: a sticky seed sits in a 2D field, wandering particles spawn along an outer circle, take unit-length random-walk steps, and stick to the cluster whenever they touch it.
Main Vein
complexification_net · mainVein
A single, meandering recursive vein grows from the center of a dark substrate.
Reaction Diffusion (Gray-Scott)
complexification_net · reactionDiffusion
Gray-Scott reaction-diffusion on a torus: two virtual chemicals U (substrate) and V (catalyst) react and diffuse on a 2D grid.