Draw Flowsnake Fractal
Generate the Gosper curve (Flowsnake) fractal. A space-filling curve based on hexagonal geometry. 100% client-side.
Generate a Gosper curve (Flowsnake) fractal by setting an iteration level, picking your colors, and clicking Draw. The tool runs L-system string rewriting under the hood — expanding the axiom through production rules, then rendering the result with turtle graphics on an 800×800 canvas.
Iteration 2 gives you the basic hexagonal shape in milliseconds. Iteration 6 produces 117,649 line segments and a nearly solid fill. And everything runs in your browser. Nothing gets uploaded.
How It Works
The generator starts with the axiom "A" and applies two substitution rules repeatedly. Each pass replaces every A and B with longer strings of moves and turns. After your chosen number of iterations, a turtle-graphics interpreter walks through the final string — moving forward for A/B, turning left 60° for +, and right 60° for –. The path gets scaled and centered, then drawn to an HTML5 Canvas element.
Examples
Quick Preview at Iteration 2
You want a fast look at the basic shape before committing to a high-detail render.
Iterations: 2
Line color: #000000
Background: #ffffff
49 line segments
Renders in under 50ms
Visible hexagonal tiling pattern
Poster-Quality Render at Iteration 5
Building a fractal art print. You need enough detail that the curve looks smooth at large sizes, with custom colors that match a dark theme.
Iterations: 5
Line color: #00ff88
Background: #111111
16,807 segments
Dense space-filling curve
Green-on-black fractal art
Maximum Detail — Iteration 6
Pushing the generator to its limit for a math presentation slide. At this level, the curve is dense enough that individual segments become nearly invisible — you get a solid filled shape that proves the fractal dimension is 2.
Iterations: 6
Line color: #3b82f6
Background: #ffffff
117,649 segments
Nearly solid fill
Takes 1–2 seconds to render
Who Uses This
Generate visual aids for lessons on fractals, recursion, and L-systems without coding anything.
Create fractal patterns for backgrounds, posters, or textile prints — download as PNG and drop into any editor.
See how L-system string rewriting translates into actual geometry, step by step through iteration levels.
Grab quick Gosper curve visuals for papers or presentations without spinning up a custom script.
Common Mistakes
It works, but 117,649 segments take a couple seconds to render. Start at 3 or 4 to check your color choices first, then bump it up when you’re happy with the look.
A dark blue line on a black background looks great in your head. On screen, the curve vanishes. Use high-contrast combos — light background with a saturated line color, or vice versa.
The Flowsnake isn’t a circle or square. Its boundary is irregular and roughly hexagonal. That’s normal — it’s a property of the Gosper curve’s hexagonal tiling structure.
Technical Details
- Processing: 100% client-side — Canvas API rendering
- Canvas Size: 800×800 pixels
- Iterations: 1 to 6 (7¹ to 7⁶ segments)
- Turn Angle: 60° (hexagonal geometry)
- Browser Support: Chrome, Firefox, Safari, Edge
- Export Format: PNG
Frequently Asked Questions
What is a Flowsnake fractal?
It’s another name for the Gosper curve, a space-filling fractal built on hexagonal geometry. Bill Gosper discovered it in the 1970s. At high iterations, the curve fills an area so completely that its fractal dimension hits 2 — same as a flat surface.
How is the Gosper curve different from a Hilbert curve?
Both are space-filling curves, but they tile differently. The Hilbert curve fills a square using 90° turns. The Gosper curve fills a roughly hexagonal region using 60° turns. The visual result is noticeably different — Gosper curves have a more organic, rounded look.
Why can’t I go above iteration 6?
Each iteration multiplies segments by 7. Iteration 7 would mean 823,543 line segments, which would freeze most browsers. Iteration 6 already produces 117,649 segments and gives you a nearly solid fill — going higher wouldn’t add visible detail anyway.
Can I use the generated fractal commercially?
The Gosper curve is a mathematical object — nobody owns it. The PNG you download is yours to use however you want. Print it, put it on a shirt, use it as album art. No attribution needed.
Does this tool upload my data anywhere?
No. The entire fractal is computed and rendered inside your browser using the Canvas API. Nothing leaves your device. You could disconnect from the internet after loading the page and it would still work.