Mustache
Original demo by Erik Dahlström, published October 4, 2009.
Mustache is a small application written entirely in SVG. A palette slides up from the bottom of the picture, and each mustache or beard in it can be dragged onto a face, then rotated, resized or removed from the keyboard. Visitors could also load another picture and export the result.
Each shape is an SVG symbol shown through a use element. Pressing a palette item clones that element and hands it to a small drag helper, which keeps a position, scale and rotation for each placed item and writes them into its transform.
The original face photograph and mustache artwork could not be reused here. This restoration has a new cartoon face and eleven newly drawn shapes that keep the original IDs, so the interaction is unchanged.
Several parts needed updates. Arrow keys no longer fire keypress, so the code listens for keydown. Dragging now uses pointer events. Save creates a file download, because browsers block the old data: URL window. Add photo now opens a file picker, and the chosen picture stays in the page.
This note was newly written for the reconstruction. Read the original post in the Internet Archive.
Topics: Interactive