Draw Hexaflake Fractal

Draw the hexaflake (hexagon snowflake) - 7-hexagon recursive fractal with 6-fold symmetry. Custom colors, fill modes. Free, offline, client-side, instant.

The hexaflake (hexagon snowflake) - each hexagon subdivides into 7 (1 center + 6 at vertex directions, each 1/3 scale). Fractal dimension log(7)/log(3) ≈ 1.7712.

How to Use Draw Hexaflake Fractal

  1. Set iteration depth (0-5). Iter 0 = single hexagon. Each iter multiplies hexagons by 7: iter 3 = 343, iter 4 = 2,401, iter 5 = 16,807. Iter 5 triggers "Drawing…" loading state.
  2. Pick hexagon size (50-500 px). Auto-scales to canvas with 40 px padding regardless, but affects the aspect of unscaled bounds.
  3. Choose render mode: Outline only (border strokes), Filled only (solid polygons), or Both. The fill-opacity slider auto-hides for Outline mode; the line-width slider auto-hides for Filled mode.
  4. Pick colors. Primary + secondary; "Alternate colors by subdivision level" toggle uses both - even-depth hexagons get secondary, odd get primary. Low-contrast colors trigger an info-toast warning.
  5. Tune fill opacity (0-1) and line width (0.5-5 px). Lower opacity lets overlapping hexagons stack visually.
  6. Press Ctrl+Enter or click Draw. Stats show hexagon count, max subdivision level reached, fractal dimension (1.7712), iteration. Render time is implicit (sub-500 ms desktop).
  7. Copy or Download. Copy puts PNG bytes on clipboard via ClipboardItem (paste into image editors). Download saves hexaflake-iter-N.png at backing-store resolution (Retina-crisp).

Frequently Asked Questions

What is a hexaflake?

A fractal generated by recursively subdividing hexagons. Each hexagon is replaced by 7 smaller hexagons: 1 at the centre, 6 at the vertex directions (each at 1/3 the parent’s size). It has perfect 6-fold rotational symmetry and Hausdorff dimension log(7)/log(3) ≈ 1.7712. It’s the hexagonal analogue of the Sierpiński triangle’s 3-fold pattern. Also called “hexaflake” or “Sierpiński hexagon” in some literature.

Why is the dimension log(7)/log(3) and not log(7)/log(2)?

Self-similarity formula: dim = log(N)/log(S) where N copies are placed at scale 1/S of the original. Hexaflake: N = 7 (centre + 6 surrounding), S = 3 (each sub-hexagon is 1/3 the parent’s diameter – because the distance from parent centre to sub-hexagon centre is 2/3 of parent radius, and sub-hexagon radius is 1/3 of parent’s). So dim = log(7)/log(3) ≈ 1.7712. Notably HIGHER than the Sierpiński triangle (log(3)/log(2) ≈ 1.585) because more sub-copies are kept per iter.

Why does the hexaflake have 6-fold symmetry?

The subdivision rule itself has 6-fold symmetry: the 6 surrounding hexagons are placed at 60°, 120°, 180°, 240°, 300°, 360° from the centre (=0° start). Rotate the whole pattern by 60° and the 6 surrounding hexagons map to themselves (relabelled). The centre hexagon also has 6-fold symmetry intrinsically. So the rule preserves the symmetry at every recursion level, and the limit pattern has 6-fold rotational symmetry.

How is this related to natural snowflakes?

Natural snowflakes have 6-fold symmetry because they’re formed from hexagonal ice crystals (water molecules form a hexagonal lattice in solid form). The hexaflake captures the MATHEMATICAL idealisation of this symmetry. Real snowflakes are NOT exact hexaflakes – they’re more like dendrites (branching crystals) with growth driven by temperature/humidity gradients. But they share the underlying 6-fold geometry. Wilson Bentley’s famous 1885 snowflake photographs show this 6-fold rule applied with infinite natural variation.

What does alternating-by-level reveal?

Each subdivision level gets a different colour. The centre hexagon (deepest level, drawn first) gets one colour; the 6 surrounding hexagons (one level shallower) get the other; their sub-hexagons alternate again. Reveals the recursive structure visually: you can trace which hexagons came from which iteration. Beautiful at iter 3-4 where the layering is visible without being overwhelming.

What’s the difference between Filled and Outline modes?

Filled: every hexagon is drawn as a solid polygon with semi-transparency (fill-opacity slider). At iter 4+ the overlaps stack into rich gradients. Outline: only the hexagon edges are stroked – emphasises the geometric structure. Both: combines fill + outline for a “sketched” look. Outline alone is great for iter 5 to see the tens-of-thousands of edges; Filled alone is great for iter 3 to see the colour structure; Both is the default for the prettiest result.

Why is iteration capped at 5?

Hexagon count at iter N = 7^N. Iter 5 = 16,807. Iter 6 = 117,649. Iter 7 = 823,543. Each hexagon is a separate Canvas fillRect+stroke operation. At ~120k operations, render time jumps to seconds; at 800k, the path data alone is tens of MB and browsers freeze. Iter 5 is the comfortable ceiling. Iter 5 already loads in ~500 ms on desktop, ~1.5 s on mobile (hence the “Drawing…” loading state).

Why are my Retina results crisp now?

The canvas has TWO resolutions: CSS-displayed size (600×600 here) and backing-store size (the pixel buffer). On Retina (DPR 2), the CSS-displayed 600 px corresponds to 1200 physical pixels. Without DPR-aware scaling, the canvas buffer stays at 600×600 and the browser upsamples to 1200 px (blurry). Now: backing store is set to 1200×1200 with a setTransform(2,…) so drawing operations are scaled accordingly.

Is my data secure?

Yes – 100% client-side. Hexagon generation and Canvas drawing happen in your browser. No parameters or images leave your device. Verify via your browser’s Network tab – only the initial HTML/CSS/JS load occurs.