Hamburger Menu Gets a Hand-Drawn Animated Twist

Mikael Ainalem shares a clever technique for turning the standard three-line hamburger icon into an animated ✕ shape. The approach relies on SVG paths and CSS properties to make the transformation feel less like a switch and more like a deliberate drawing.

The core trick: instead of drawing each line as a straight <line />, each becomes a <path /> that curves upward, downward, and around to eventually form the cross stroke. Initially, stroke-dasharray reveals only a portion of the path, making the curve look like a simple flat mark. Then, by animating both stroke-dasharray and stroke-dashoffset together, the hidden part of the path comes into view and the ✕ appears.

Direct Link →