Burger Morph
X-ray · layers
Parameters
How this effect works
The icon is just three bars and a single boolean: open. When it's closed, the bars sit at -gap, 0 and +gap — a hamburger. When it opens, the top and bottom bars slide to the center (translateY 0) and rotate +45° and −45°, so they cross into an X. The middle bar simply fades out, because an X has no middle. Every bit of it is a CSS transition on a transform, so the browser tweens it smoothly for free.
Flip morph off and the bars still stack in the center but don't rotate — you see that the rotation is what makes the X. Flip middle off and the fade stops, so the third bar hangs around in the X (which is exactly wrong — that's the point). Spin rotates the whole button 180° as it goes, and gap, thickness and roundness restyle the bars live. Click it, or watch it toggle on its own.