Draw Triflake Fractal

Draw a 120° L-system triangle fractal (axiom F+F+F, F → F-F+F). Space-filling dim 2.0. Free, offline, client-side, instant, secure.

Renders an L-system curve from the closed-triangle axiom F+F+F with rule F → F-F+F at 120° turns. The default angle gives a space-filling curve (similarity dimension log(3)/log(√3) = 2.0). The name "triflake" is non-standard - see the FAQ for what this is and isn't.

How to Use Draw Triflake Fractal

  1. Pick iterations (0-8). Closed-triangle base has 3 starting segments; each iteration triples them, so iter N has 3 × 3ᴺ segments.
  2. Set segment length and angle. Default 120° gives a space-filling curve; other angles produce non-canonical experimental figures.
  3. Pick a color and a gradient mode: none, linear (lightens along traversal), or radial (darker toward edges).
  4. Adjust line width (1-4 px).
  5. Optionally enable construction lines - draws a simple equilateral-triangle outline behind the curve as a visual reference.
  6. Click Draw Fractal or press Ctrl/Cmd + Enter. Iter 7+ shows a non-blocking time estimate.
  7. Copy or download the PNG.

Frequently Asked Questions

What does this tool actually draw?

It traces the L-system with axiom F+F+F (closed equilateral triangle at 120° turns) and rule F → F-F+F applied N times. Each F is “draw forward one unit”; + and − rotate the heading by the chosen angle. The default 120° produces a curve that’s a mirror variant of Knuth’s terdragon – a space-filling triangular curve, not a Koch-style frilly edge.

Is this the classical “triflake” or the Koch snowflake?

Neither. In n-flake terminology, “triflake” usually means the N=3 case of the polyflake family, i.e. the Sierpinski triangle (which uses area subdivision, not curve construction). The Koch snowflake, by contrast, uses 60° turns and the rule F → F-F++F-F. This tool uses 120° turns and a different rule, so it matches neither canonical form – it is a custom triangular L-system curve. The original FAQ called this “Minkowski sausage variant”, which is also inaccurate; the Minkowski sausage uses 90° turns and a 4-segment replacement rule.

What is the fractal dimension?

At the default 120° angle the similarity dimension is exactly 2.0 – the curve is space-filling. The Moran equation: 3 copies × (1/√3) to the d = 1 gives d = log(3)/log(√3) = 2. (Each F-F+F segment displaces √3 units net, verified by trace.) An older version of this tool claimed log(3)/log(2) ≈ 1.5850, which is the Sierpinski triangle’s dimension – pasted in by association with the word “triangle”. The code’s getFractalDimension() and the stats line both report 2.0000 now.

What if I change the angle?

Only 120° gives the named space-filling curve. Other angles produce a recognisable but non-canonical figure with different self-similarity properties – sometimes self-overlapping, sometimes open. The stats line labels these as “non-canonical angle N°” so you know you’ve left the named fractal.

What happened to the construction-lines bug?

The original construction-lines code scaled the base triangle by Math.pow(3, countSegments(lsystem)/3) – at iter 5 that’s Math.pow(3, 729/3) = 3^243, an astronomical number that drew nothing useful. The fix draws a simple equilateral-triangle outline at the curve’s bounding-box scale instead, which is what the feature was clearly meant to do.

Is anything sent to a server?

No. The tool loads three static files (HTML, CSS, JS) and then runs entirely in your browser – L-system expansion, drawing, PNG export, clipboard copy. You can disconnect from the internet after the page loads. No analytics, no tracking, no cookies.

Is this tool free?

Yes – free, unlimited, no signup, no watermark. Use the PNGs in lectures, papers, blog posts, or art freely. Attribution to is appreciated but not required.