Home Tools Blog About

Draw Flowsnake Fractal

In short

Draw the Gosper curve hexagonal space-filling fractal in your browser. Iterations 1-6, custom colors, fill mode, PNG export. Free, offline, client-side, instant.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

L-system space-filling curve with 60° hexagonal turns (Bill Gosper, 1973). Note: the A and B symbols act as draw-forward commands (the standard convention), and the Gosper curve is genuinely space-filling - fractal dimension 2.

🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Draw Flowsnake Fractal

Draw Flowsnake Fractal · free online tool · All Tools Verse
Draw Flowsnake Fractal. Free online tool that runs in your browser.
  1. Understand the L-system. Axiom A. Rules A → A-B--B+A++AA+B- and B → +A-BB--B-A++A+B. BOTH A and BF was treated as a draw command, but F never appeared in the rules.
  2. Pick iterations 1-6. Each iter multiplies segment count by 7: iter 1 = 7, iter 2 = 49, iter 3 = 343, iter 4 = 2,401, iter 5 = 16,807, iter 6 = 117,649. Iter 5-6 trigger the "Drawing…" loading state.
  3. Tune line length, canvas size, line width. The curve auto-scales to fit canvas with 40 px padding.
  4. Choose colors: line, background, optional fill. Low-contrast pairs (YIQ distance < 50) trigger an info toast.
  5. Toggle Fill mode to close the path and fill the interior. The Gosper curve fills a hexagonal region (the "Gosper island").
  6. Press Ctrl+Enter or click Draw. Stats show segments, total summed path length, L-system character count, fractal dimension (2.0 - truly space-filling), render time.
  7. Copy or Download. Copy puts PNG bytes on clipboard via ClipboardItem. Download saves flowsnake-iter-N.png.

Frequently Asked Questions

What is the Flowsnake / Gosper curve?

A space-filling curve discovered by mathematician Bill Gosper in 1973. It’s defined by an L-system over a hexagonal grid: starting from a single segment, each iteration replaces every segment with a 7-segment zig-zag pattern that turns in 60° increments. The infinite limit fills the “Gosper island” – a Koch-snowflake-like fractal-bounded region. The curve itself has Hausdorff dimension 2; the boundary of the Gosper island has dimension log(7)/log(3) ≈ 1.1292.

Why is it called “Flowsnake”?

A portmanteau of “flow” (the smooth winding path) and “snake” (the serpentine zigzag look). The term appeared in Martin Gardner’s 1976 Scientific American column where he popularised Gosper’s discovery. Alternative names: “Gosper curve” (after the discoverer), “Peano-Gosper curve” (placing it in the lineage of Peano’s original 1890 space-filling curve), or just “hexagonal Gosper”.

What’s the relationship to the Hilbert curve?

Both are space-filling curves with dimension 2. Differences: Hilbert (1891) uses a square grid with 90° turns and fills a square. Gosper (1973) uses a hexagonal grid with 60° turns and fills the Gosper island. Hilbert visits a 2^n × 2^n grid of cells per iteration; Gosper visits 7^n cells. Hilbert is more useful for spatial indexing (preserves locality on a power-of-2 grid). Gosper is more visually pleasing – smoother curves due to 60° angles.

What does the rule string mean?

A → A-B--B+A++AA+B-. Read left to right: draw A (forward), turn right 60°, draw B (forward), turn right 120° (two minuses), draw B, turn left 60°, draw A, turn left 120°, draw A, draw A, turn left 60°, draw B, turn right 60°. So one A becomes a 7-segment zigzag containing 4 A’s and 3 B’s. Similarly for B. Total: every iter multiplies symbol count by 7.

Why is iteration capped at 6?

Iter 6 produces 7^6 = 117,649 draw-forward segments – that’s the slow case (~3 s desktop, may be 5 s on phones). Iter 7 would be 7^7 = 823,543. Each segment is a separate Canvas lineTo call inside one beginPathstroke batch. At ~1M lineTo calls, the path data alone takes tens of MB and rendering enters the “browser freezes” zone. Iter 6 is the comfortable ceiling.

Why is the fractal dimension exactly 2?

Standard self-similarity formula: dim = log(N) / log(S) where N copies are placed at scale 1/S. Gosper: N = 7 copies of A or B per iteration, each at scale 1/√7 of the original size. So dim = log(7)/log(√7) = log(7) / ((1/2) log(7)) = 2. Dimension 2 confirms the space-filling property: in the infinite limit, the curve covers the Gosper island with positive area.

What’s “fill mode” doing?

Calls ctx.fill() after building the path. Canvas interprets the path as a closed shape (auto-closing the last point to the first) and fills using the non-zero winding rule. For the Gosper curve at intermediate iterations, fill mode visualises the Gosper island – the hexagonally-bounded region the curve covers. At iter 5-6 with thin lines, fill mode + a darker line color produces a striking outline-on-fill effect.

Is my data secure?

Yes – 100% client-side. L-system expansion and Canvas drawing happen in your browser. No parameters or images leave your device. Verify in your browser’s Network tab.

Keep going

Related Tools

All Fractals tools →

Draw Canopy Fractal

Draw a canopy-tree L-system fractal in your browser. 7 iterations, custom colors, gradient depth,…

Draw Cantor Dust Fractal

Draw true Cantor Dust (4-corner) or Sierpiński carpet (8-square) in your browser. Color modes,…

Draw Cantor Fractal

Draw the Cantor set with middle-third deletion. 0-10 iterations, custom colors, dimension and measure…

Draw Frosty Fractal

Draw Frosty Fractal online, free and private. Runs in your browser, no upload, instant…

Draw Hausdorff Fractal

Draw the Hilbert curve or Moore curve (closed-loop variant) - true space-filling fractals (dim…

Draw Heighway Fractal

Draw the Heighway dragon (paper-folding fractal) with fire gradient and symmetry modes. L-system based.…

Draw Hexaflake Fractal

Draw the hexaflake (hexagon snowflake) - 7-hexagon recursive fractal with 6-fold symmetry. Custom colors,…

Draw Hilbert Fractal

Draw the Hilbert space-filling curve in your browser. 9 iterations, rotation, gradient, endpoints. Free,…

Draw Koch Fractal

Draw Koch curve, snowflake, or anti-snowflake at any angle. Iterations 0-7. Free, offline, client-side,…

Draw Levy Fractal

Draw the Lévy C-curve (Paul Lévy 1938) - space-filling fractal at 45°. Gradient and…

Draw Mcworter Dendrite Fractal

Draw Mcworter Dendrite Fractal online, free and private. Runs in your browser, no upload,…

Draw Moore Fractal

Draw the Moore curve (Eliakim Moore 1900) - closed-loop space-filling fractal. Start/end markers, 4-fold…

Share

Embed this tool

Add this free tool to your website. Copy and paste the code: