Binary Spiral Creator
Generate and customize stunning binary tree spirals with adjustable depth, arms, colors, and animation. Export as PNG or SVG.
About
A binary spiral is a fractal structure formed by recursively splitting each node into two children while arranging them radially. At depth d, the tree contains 2d nodes. Each node is placed in polar coordinates at angle θ = θbase + i ⋅ 2π2d and radius r = r0 + d ⋅ Δr. Incorrect parameterization leads to overlapping nodes or visual collapse. This tool computes exact polar placements and renders the full tree in real time on an HTML Canvas.
The generator supports up to depth 10 (1024 leaf nodes). Adjusting the angular spread φ below 0.3 rad produces tight spirals. Values above 1.5 rad create open fan structures. Color is mapped per depth level using linear interpolation between two user-defined colors. Animation rotates the global angle offset at a configurable rate. This tool approximates continuous spirals using discrete binary branching. It does not produce Archimedean or logarithmic spirals natively.
Formulas
Each node in the binary spiral is positioned using polar-to-Cartesian conversion. For a node at depth d with sibling index i (ranging from 0 to 2d − 1):
Cartesian coordinates derived from polar:
Color interpolation between start color C0 and end color C1 at depth d with maximum depth D:
Where θ0 = initial angle offset, φ = angular spread per depth level (controls spiral tightness), ωt = animation rotation offset at time t, r0 = initial radius from center, Δr = radius increment per depth level, D = maximum tree depth.
Reference Data
| Depth d | Total Nodes | Leaf Nodes | Connections | Visual Character |
|---|---|---|---|---|
| 1 | 3 | 2 | 2 | Simple fork |
| 2 | 7 | 4 | 6 | Basic cross |
| 3 | 15 | 8 | 14 | Emerging spiral |
| 4 | 31 | 16 | 30 | Clear spiral arms |
| 5 | 63 | 32 | 62 | Dense spiral |
| 6 | 127 | 64 | 126 | Fractal detail visible |
| 7 | 255 | 128 | 254 | High density pattern |
| 8 | 511 | 256 | 510 | Complex fractal |
| 9 | 1023 | 512 | 1022 | Very dense fractal |
| 10 | 2047 | 1024 | 2046 | Maximum complexity |
| Angular Spread Reference | ||||
| φ = 0.2 rad | Tight coil, nodes overlap at depth > 6 | |||
| φ = 0.5 rad | Classic spiral, good separation | |||
| φ = 1.0 rad | Wide spiral arms | |||
| φ = 1.5 rad | Fan-like structure | |||
| φ = π rad | Symmetric binary tree (no spiral) | |||
| Radius Step Reference | ||||
| Δr = 10 px | Compact, overlapping at high depth | |||
| Δr = 30 px | Balanced spacing | |||
| Δr = 50 px | Wide rings, needs large canvas | |||
| Node Count Formula | ||||
| Total nodes | 2d+1 − 1 | |||
| Leaf nodes | 2d | |||
| Internal nodes | 2d − 1 | |||
Frequently Asked Questions
prefers-reduced-motion: reduce media query. When active, animation is disabled by default and the animate toggle is turned off. Users can still manually enable animation if desired.