Draw Twin Heighway Dragon Fractal
Generate the Twin Dragon fractal — two Heighway dragons joined together. 100% client-side.
Generate twin Heighway dragon fractals — two mirrored dragon curves that interlock from a shared base segment — by setting iteration depth, picking dual colors, and adjusting line width. Hit Draw and download the result as PNG. And everything runs in your browser. Nothing gets uploaded.
How It Works
The tool starts with a single line segment. At each iteration, it applies the Heighway dragon folding rule — rotate 90° around the midpoint, alternating left and right. It does this twice, once for each dragon, but mirrors the second copy. After your chosen number of iterations, both curves get drawn onto an HTML5 canvas with your selected colors and stroke width.
Examples
Quick Logo Texture
You need a geometric background pattern for a poster. Low iteration count, bold colors.
Iterations: 5
Dragon 1: #ff3366
Dragon 2: #3366ff
Background: #ffffff
Line Width: 3
Two bold, angular dragons with 32 segments each. Visible folding structure, great for backgrounds.
Detailed Math Illustration
For a presentation on space-filling curves. High iteration count, thin lines so the structure is clear.
Iterations: 13
Dragon 1: #1a1a2e
Dragon 2: #e94560
Background: #f5f5f5
Line Width: 1
8,192 segments per dragon. Dense, intricate twin shape with clear boundary detail. Renders in ~2 seconds.
Dark-Mode Desktop Wallpaper
Neon dragons on a dark background for a 1920×1080 wallpaper. Medium iterations so the shape reads at arm’s length.
Iterations: 10
Dragon 1: #00ff88
Dragon 2: #ff00cc
Background: #0a0a0a
Line Width: 2
1,024 segments per dragon. Glowing neon look against black — download the PNG and set as wallpaper directly.
Who Uses This
Generate visual aids for lessons on fractals, recursion, and space-filling curves.
Create unique geometric patterns for posters, album covers, and textile prints.
Test canvas rendering performance or grab fractal PNGs for placeholder art in apps.
Explore how iteration depth changes fractal complexity for homework and projects.
Common Mistakes
Each iteration doubles the segment count. At 15, that’s 32,768 segments per dragon — your browser might chug. Start at 10 or 11 and work up.
The whole point of a twin dragon is seeing how two mirrored curves interlock. If both are the same shade of blue, you lose that contrast entirely. Pick complementary or high-contrast colors.
A line width of 5+ with 12+ iterations turns the fractal into a solid blob. Thin lines (1–2px) let you actually see the detail at higher depths.
Technical Details
- Processing: 100% client-side — HTML5 Canvas API
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Iterations: 15 (32,768 segments per dragon)
- Output Format: PNG download at canvas resolution
- Line Width Range: 1–10 pixels
Frequently Asked Questions
What is a twin Heighway dragon fractal?
It’s two Heighway dragon curves that share the same starting line segment but fold in opposite directions. When drawn together they form a closed, roughly triangular shape with fractal edges. Mathematicians sometimes call it the Davis–Knuth dragon. The shape tiles the plane perfectly, which is part of why it shows up in so many textbooks.
How is the twin dragon different from a regular Heighway dragon?
A regular Heighway dragon is one curve that folds repeatedly. The twin version takes two copies of that curve, mirrors the second one, and joins them at the base. You get a symmetric, closed boundary instead of an open squiggly line. Think of it as the difference between one arm and two arms clasped together.
How many iterations do I need for a good-looking fractal?
10 to 12 is the sweet spot. Below 8, you can still see the individual folds and it looks more like a zigzag than a fractal. Above 13, the detail gets so dense that it mostly benefits zoomed-in views or very large canvases.
Can I use the downloaded PNG commercially?
Yes. The fractal is generated by a mathematical algorithm — there is no copyright on the shape itself. The PNG you download is yours to use however you want, including commercial projects, prints, or merchandise.
Does this tool upload my data anywhere?
No. The entire fractal computation and rendering happens inside your browser using the Canvas API. Nothing leaves your machine. You don’t even need an internet connection after the page loads.