Mustache
Drag cartoon mustaches and beards onto a face, then rotate, resize and save the result.
What you are seeing
A cartoon of a smiling round-faced person with short dark hair and a red striped sweater, in front of green hills and a sunny sky. A palette of eleven black mustache and beard shapes slides up from the bottom edge.
How it works
Each mustache is a symbol, shown in the palette through a use element.
Pressing a palette item clones its use element and starts dragging the clone.
Rotation and scale are kept per item and rebuilt into its transform attribute.
Saving serializes the symbols, picture and placed items into one standalone SVG file.
History
Posted on October 4, 2009, as an example of a small interactive SVG application.
Source
/mustache/beard.svg
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 800 600" style="background:black" onload="sw.init();init()">
<title>Mustache</title>
<desc>A cartoon face with a palette of eleven mustaches and beards that slides up from the bottom edge. Drag a shape onto the face, then rotate, resize or remove it with the keyboard.</desc>
<!-- Interaction code by Erik Dahlstrom, CC0. The face and all mustache shapes
were redrawn for this restoration and replace the original art. -->
<defs>
<script xlink:href="../res/2.0/scripts/compat/no-unload.js" />
<script xlink:href="simple_drag.js"/>
<script xlink:href="../res/2.0/scripts/yui/yahoo-dom-event/yahoo-dom-event.js" />
<script xlink:href="../res/2.0/scripts/yui/animation/animation-min.js" />
<script xlink:href="../res/2.0/scripts/dom-utils.js" />
<script xlink:href="../res/2.0/scripts/utils/ez-transform.js" />
<script xlink:href="../res/2.0/scripts/animation/animate.js" />
<script xlink:href="../res/2.0/scripts/widgets/sensor.js" />
<script xlink:href="../res/2.0/scripts/widgets/scroller.js" />
<g id="templates" style="fill:#161413; stroke:#0c1007; stroke-linecap:round; stroke-linejoin:round;" >
<symbol id="fluffybeard" class="template" viewBox="-134 -22 268 137">
<path fill-rule="evenodd" d="M122.0 8.0 L124.9 10.6 L127.1 13.3 L128.1 16.0 L127.8 18.7 L126.1 21.2 L123.3 23.5 L119.9 25.6 L116.4 27.6 L113.5 29.6 L111.5 31.7 L110.6 34.0 L110.9 36.6 L112.1 39.5 L113.8 42.7 L115.2 45.9 L116.1 49.0 L115.8 51.9 L114.3 54.3 L111.6 56.1 L107.9 57.5 L103.7 58.5 L99.6 59.4 L95.9 60.4 L93.0 61.8 L91.2 63.7 L90.3 66.2 L90.1 69.3 L90.2 72.7 L90.1 76.1 L89.4 79.3 L87.8 81.8 L85.3 83.6 L81.9 84.6 L77.9 84.8 L73.5 84.6 L69.2 84.2 L65.3 84.1 L62.1 84.6 L59.5 85.9 L57.5 88.0 L55.9 90.8 L54.4 93.9 L52.7 97.1 L50.6 99.9 L48.0 101.8 L44.8 102.8 L41.2 102.7 L37.3 101.8 L33.4 100.3 L29.6 98.8 L26.0 97.6 L22.7 97.1 L19.7 97.5 L16.9 98.9 L14.1 101.0 L11.3 103.6 L8.2 106.1 L5.0 108.0 L1.7 109.1 L-1.7 109.1 L-5.0 108.0 L-8.2 106.1 L-11.3 103.6 L-14.1 101.0 L-16.9 98.9 L-19.7 97.5 L-22.7 97.1 L-26.0 97.6 L-29.6 98.8 L-33.4 100.3 L-37.3 101.8 L-41.2 102.7 L-44.8 102.8 L-48.0 101.8 L-50.6 99.9 L-52.7 97.1 L-54.4 93.9 L-55.9 90.8 L-57.5 88.0 L-59.5 85.9 L-62.1 84.6 L-65.3 84.1 L-69.2 84.2 L-73.5 84.6 L-77.9 84.8 L-81.9 84.6 L-85.3 83.6 L-87.8 81.8 L-89.4 79.3 L-90.1 76.1 L-90.2 72.7 L-90.1 69.3 L-90.3 66.2 L-91.2 63.7 L-93.0 61.8 L-95.9 60.4 L-99.6 59.4 L-103.7 58.5 L-107.9 57.5 L-111.6 56.1 L-114.3 54.3 L-115.8 51.9 L-116.1 49.0 L-115.2 45.9 L-113.8 42.7 L-112.1 39.5 L-110.9 36.6 L-110.6 34.0 L-111.5 31.7 L-113.5 29.6 L-116.4 27.6 L-119.9 25.6 L-123.3 23.5 L-126.1 21.2 L-127.8 18.7 L-128.1 16.0 L-127.1 13.3 L-124.9 10.6 L-122.0 8.0 L-122.0 4.0 L-117.9 3.9 L-113.7 3.4 L-109.6 1.8 L-105.5 -0.8 L-101.3 -3.5 L-97.2 -5.5 L-93.1 -6.1 L-88.9 -5.6 L-84.8 -4.7 L-80.6 -4.3 L-76.5 -4.9 L-72.4 -6.8 L-68.2 -9.2 L-64.1 -11.2 L-60.0 -12.1 L-55.8 -11.8 L-51.7 -10.6 L-47.6 -9.5 L-43.4 -9.4 L-39.3 -10.5 L-35.2 -12.4 L-31.0 -14.4 L-26.9 -15.5 L-22.7 -15.3 L-18.6 -14.1 L-14.5 -12.5 L-10.3 -11.6 L-6.2 -11.8 L-2.1 -13.1 L2.1 -14.9 L6.2 -16.1 L10.3 -16.2 L14.5 -15.0 L18.6 -13.1 L22.7 -11.4 L26.9 -10.8 L31.0 -11.3 L35.2 -12.7 L39.3 -13.9 L43.4 -14.2 L47.6 -13.1 L51.7 -11.1 L55.8 -8.9 L60.0 -7.4 L64.1 -7.2 L68.2 -7.9 L72.4 -9.0 L76.5 -9.5 L80.6 -8.7 L84.8 -6.7 L88.9 -4.1 L93.1 -1.9 L97.2 -0.8 L101.3 -0.9 L105.5 -1.6 L109.6 -2.0 L113.7 -1.4 L117.9 0.6 L122.0 4.0 Z M42.0 26.0 L41.8 27.0 L41.4 27.9 L40.6 28.8 L39.5 29.8 L38.1 30.6 L36.4 31.5 L34.4 32.3 L32.2 33.1 L29.7 33.8 L27.0 34.4 L24.1 35.0 L21.0 35.5 L17.7 36.0 L14.4 36.3 L10.9 36.6 L7.3 36.8 L3.7 37.0 L0.0 37.0 L-3.7 37.0 L-7.3 36.8 L-10.9 36.6 L-14.4 36.3 L-17.7 36.0 L-21.0 35.5 L-24.1 35.0 L-27.0 34.4 L-29.7 33.8 L-32.2 33.1 L-34.4 32.3 L-36.4 31.5 L-38.1 30.6 L-39.5 29.8 L-40.6 28.8 L-41.4 27.9 L-41.8 27.0 L-42.0 26.0 L-41.8 25.0 L-41.4 24.1 L-40.6 23.2 L-39.5 22.2 L-38.1 21.4 L-36.4 20.5 L-34.4 19.7 L-32.2 18.9 L-29.7 18.2 L-27.0 17.6 L-24.1 17.0 L-21.0 16.5 L-17.7 16.0 L-14.4 15.7 L-10.9 15.4 L-7.3 15.2 L-3.7 15.0 L-0.0 15.0 L3.7 15.0 L7.3 15.2 L10.9 15.4 L14.4 15.7 L17.7 16.0 L21.0 16.5 L24.1 17.0 L27.0 17.6 L29.7 18.2 L32.2 18.9 L34.4 19.7 L36.4 20.5 L38.1 21.4 L39.5 22.2 L40.6 23.2 L41.4 24.1 L41.8 25.0 Z"/>
</symbol>
<symbol id="muttonchops" class="template" viewBox="-107 -98 214 189">
<path d="M75.0 -92.4 L74.3 -87.8 L73.5 -83.1 L72.6 -78.5 L71.7 -73.8 L70.8 -69.1 L69.8 -64.5 L68.9 -59.8 L67.9 -55.2 L66.9 -50.5 L66.0 -45.9 L65.0 -41.2 L64.1 -36.5 L63.2 -31.9 L62.3 -27.2 L61.5 -22.6 L60.7 -17.9 L59.9 -13.2 L59.2 -8.6 L58.5 -3.9 L57.8 0.8 L57.2 5.4 L56.7 10.1 L56.2 14.8 L55.7 19.5 L55.3 24.2 L55.0 28.8 L54.7 33.5 L54.5 38.2 L54.3 42.9 L54.2 47.6 L54.1 52.3 L54.1 57.0 L54.1 61.7 L62.5 50.3 L88.2 49.6 L85.2 47.2 L81.6 44.2 L77.8 41.5 L74.1 38.9 L70.3 36.6 L66.4 34.4 L62.6 32.5 L58.7 30.7 L54.8 29.2 L51.0 27.9 L47.1 26.8 L43.2 25.8 L39.4 25.1 L35.6 24.6 L31.9 24.3 L28.2 24.1 L24.6 24.2 L21.0 24.3 L17.5 24.6 L14.2 25.0 L13.8 43.0 L16.5 43.5 L18.9 44.3 L21.2 45.2 L23.5 46.4 L25.8 47.6 L28.0 49.0 L30.1 50.5 L32.2 52.1 L34.3 53.8 L36.4 55.7 L38.4 57.6 L40.5 59.7 L42.6 61.8 L44.6 64.1 L46.7 66.4 L48.9 68.9 L51.0 71.5 L53.2 74.2 L55.5 77.0 L58.4 80.6 L89.5 84.7 L98.4 63.9 L98.9 59.3 L99.4 54.6 L99.8 49.9 L100.1 45.2 L100.4 40.5 L100.6 35.8 L100.8 31.1 L100.9 26.4 L101.0 21.7 L101.0 17.0 L101.0 12.3 L100.9 7.6 L100.8 2.9 L100.6 -1.8 L100.4 -6.5 L100.1 -11.2 L99.8 -15.9 L99.5 -20.7 L99.1 -25.4 L98.7 -30.1 L98.3 -34.8 L97.8 -39.6 L97.3 -44.3 L96.8 -49.0 L96.4 -53.8 L95.9 -58.5 L95.4 -63.2 L94.9 -67.9 L94.4 -72.7 L94.0 -77.4 L93.6 -82.1 L93.2 -86.8 L93.0 -91.6 Z M-93.0 -91.6 L-93.2 -86.8 L-93.6 -82.1 L-94.0 -77.4 L-94.4 -72.7 L-94.9 -67.9 L-95.4 -63.2 L-95.9 -58.5 L-96.4 -53.8 L-96.8 -49.0 L-97.3 -44.3 L-97.8 -39.6 L-98.3 -34.8 L-98.7 -30.1 L-99.1 -25.4 L-99.5 -20.7 L-99.8 -15.9 L-100.1 -11.2 L-100.4 -6.5 L-100.6 -1.8 L-100.8 2.9 L-100.9 7.6 L-101.0 12.3 L-101.0 17.0 L-101.0 21.7 L-100.9 26.4 L-100.8 31.1 L-100.6 35.8 L-100.4 40.5 L-100.1 45.2 L-99.8 49.9 L-99.4 54.6 L-98.9 59.3 L-98.4 63.9 L-89.5 84.7 L-58.4 80.6 L-55.5 77.0 L-53.2 74.2 L-51.0 71.5 L-48.9 68.9 L-46.7 66.4 L-44.6 64.1 L-42.6 61.8 L-40.5 59.7 L-38.4 57.6 L-36.4 55.7 L-34.3 53.8 L-32.2 52.1 L-30.1 50.5 L-28.0 49.0 L-25.8 47.6 L-23.5 46.4 L-21.2 45.2 L-18.9 44.3 L-16.5 43.5 L-13.8 43.0 L-14.2 25.0 L-17.5 24.6 L-21.0 24.3 L-24.6 24.2 L-28.2 24.1 L-31.9 24.3 L-35.6 24.6 L-39.4 25.1 L-43.2 25.8 L-47.1 26.8 L-51.0 27.9 L-54.8 29.2 L-58.7 30.7 L-62.6 32.5 L-66.4 34.4 L-70.3 36.6 L-74.1 38.9 L-77.8 41.5 L-81.6 44.2 L-85.2 47.2 L-88.2 49.6 L-62.5 50.3 L-54.1 61.7 L-54.1 57.0 L-54.1 52.3 L-54.2 47.6 L-54.3 42.9 L-54.5 38.2 L-54.7 33.5 L-55.0 28.8 L-55.3 24.2 L-55.7 19.5 L-56.2 14.8 L-56.7 10.1 L-57.2 5.4 L-57.8 0.8 L-58.5 -3.9 L-59.2 -8.6 L-59.9 -13.2 L-60.7 -17.9 L-61.5 -22.6 L-62.3 -27.2 L-63.2 -31.9 L-64.1 -36.5 L-65.0 -41.2 L-66.0 -45.9 L-66.9 -50.5 L-67.9 -55.2 L-68.9 -59.8 L-69.8 -64.5 L-70.8 -69.1 L-71.7 -73.8 L-72.6 -78.5 L-73.5 -83.1 L-74.3 -87.8 L-75.0 -92.4 Z"/>
</symbol>
<symbol id="fumanchu" class="template" viewBox="-63 -17 125 173">
<path d="M7.7 11.5 L11.8 12.1 L13.1 12.6 L15.0 13.4 L16.8 14.6 L18.7 15.8 L20.6 17.3 L22.5 18.9 L24.3 20.6 L26.2 22.3 L28.0 24.2 L29.7 26.2 L31.5 28.2 L33.3 30.3 L35.0 32.5 L36.7 34.7 L38.4 36.9 L39.3 37.8 L39.3 38.0 L39.5 40.1 L39.8 42.7 L40.1 45.4 L40.4 48.0 L40.7 50.8 L41.0 53.5 L41.3 56.3 L41.5 59.1 L41.8 61.9 L42.1 64.8 L42.4 67.6 L42.7 70.6 L43.0 73.5 L43.3 76.4 L43.6 79.4 L43.9 82.4 L44.2 85.5 L44.5 88.5 L44.8 91.6 L45.1 94.7 L45.5 97.8 L45.8 100.9 L46.1 104.1 L46.4 107.2 L46.7 110.4 L47.1 113.6 L47.4 116.8 L47.7 120.1 L48.1 123.3 L48.4 126.6 L48.8 129.9 L49.1 133.2 L49.5 136.6 L49.9 139.9 L50.3 143.3 L50.7 146.6 L51.3 150.0 L52.7 150.0 L53.0 146.6 L53.3 143.2 L53.4 139.8 L53.6 136.4 L53.8 133.1 L53.9 129.7 L54.0 126.4 L54.2 123.1 L54.3 119.9 L54.4 116.6 L54.5 113.4 L54.6 110.1 L54.7 106.9 L54.9 103.7 L55.0 100.6 L55.0 97.4 L55.1 94.3 L55.2 91.2 L55.3 88.1 L55.4 85.1 L55.5 82.0 L55.6 79.0 L55.7 76.0 L55.7 73.0 L55.8 70.1 L55.9 67.1 L56.0 64.2 L56.0 61.4 L56.1 58.5 L56.2 55.7 L56.3 52.9 L56.3 50.1 L56.4 47.4 L56.5 44.7 L56.5 42.0 L56.6 39.4 L56.6 36.3 L55.9 31.3 L53.6 27.2 L52.0 24.5 L50.4 21.8 L48.8 19.1 L47.1 16.5 L45.3 14.0 L43.5 11.4 L41.6 8.9 L39.6 6.4 L37.4 3.9 L35.2 1.5 L32.7 -0.9 L30.0 -3.2 L26.9 -5.5 L23.3 -7.8 L18.2 -10.1 L12.3 -11.5 Z M-12.3 -11.5 L-18.2 -10.1 L-23.3 -7.8 L-26.9 -5.5 L-30.0 -3.2 L-32.7 -0.9 L-35.2 1.5 L-37.4 3.9 L-39.6 6.4 L-41.6 8.9 L-43.5 11.4 L-45.3 14.0 L-47.1 16.5 L-48.8 19.1 L-50.4 21.8 L-52.0 24.5 L-53.6 27.2 L-55.9 31.3 L-56.6 36.3 L-56.6 39.4 L-56.5 42.0 L-56.5 44.7 L-56.4 47.4 L-56.3 50.1 L-56.3 52.9 L-56.2 55.7 L-56.1 58.5 L-56.0 61.4 L-56.0 64.2 L-55.9 67.1 L-55.8 70.1 L-55.7 73.0 L-55.7 76.0 L-55.6 79.0 L-55.5 82.0 L-55.4 85.1 L-55.3 88.1 L-55.2 91.2 L-55.1 94.3 L-55.0 97.4 L-55.0 100.6 L-54.9 103.7 L-54.7 106.9 L-54.6 110.1 L-54.5 113.4 L-54.4 116.6 L-54.3 119.9 L-54.2 123.1 L-54.0 126.4 L-53.9 129.7 L-53.8 133.1 L-53.6 136.4 L-53.4 139.8 L-53.3 143.2 L-53.0 146.6 L-52.7 150.0 L-51.3 150.0 L-50.7 146.6 L-50.3 143.3 L-49.9 139.9 L-49.5 136.6 L-49.1 133.2 L-48.8 129.9 L-48.4 126.6 L-48.1 123.3 L-47.7 120.1 L-47.4 116.8 L-47.1 113.6 L-46.7 110.4 L-46.4 107.2 L-46.1 104.1 L-45.8 100.9 L-45.5 97.8 L-45.1 94.7 L-44.8 91.6 L-44.5 88.5 L-44.2 85.5 L-43.9 82.4 L-43.6 79.4 L-43.3 76.4 L-43.0 73.5 L-42.7 70.6 L-42.4 67.6 L-42.1 64.8 L-41.8 61.9 L-41.5 59.1 L-41.3 56.3 L-41.0 53.5 L-40.7 50.8 L-40.4 48.0 L-40.1 45.4 L-39.8 42.7 L-39.5 40.1 L-39.3 38.0 L-39.3 37.8 L-38.4 36.9 L-36.7 34.7 L-35.0 32.5 L-33.3 30.3 L-31.5 28.2 L-29.7 26.2 L-28.0 24.2 L-26.2 22.3 L-24.3 20.6 L-22.5 18.9 L-20.6 17.3 L-18.7 15.8 L-16.8 14.6 L-15.0 13.4 L-13.1 12.6 L-11.8 12.1 L-7.7 11.5 Z"/>
</symbol>
<symbol id="zappa" class="template" viewBox="-87 -22 174 122">
<path d="M0.0 28.0 L1.4 28.0 L2.8 28.0 L4.1 28.0 L5.4 28.0 L6.6 28.0 L7.9 27.9 L9.1 27.9 L10.3 27.9 L11.5 27.9 L12.6 27.9 L13.8 27.9 L14.9 27.9 L16.1 28.0 L17.2 28.0 L18.3 28.0 L19.4 28.1 L20.5 28.1 L21.6 28.2 L22.7 28.3 L23.9 28.3 L25.0 28.4 L26.1 28.6 L27.2 28.7 L28.4 28.8 L29.6 29.0 L30.7 29.2 L31.9 29.4 L33.1 29.6 L34.4 29.9 L35.6 30.1 L36.9 30.4 L38.2 30.8 L39.6 31.1 L40.9 31.5 L42.3 32.0 L43.7 32.4 L45.2 33.0 L46.6 33.5 L48.1 34.1 L49.7 34.7 L51.3 35.4 L52.9 36.1 L54.5 36.9 L56.2 37.7 L57.9 38.5 L59.7 39.4 L61.5 40.4 L63.4 41.3 L65.3 42.4 L67.3 43.4 L69.3 44.5 L71.4 45.7 L73.7 46.8 L76.1 47.9 L79.2 48.6 L80.8 47.4 L81.0 44.2 L80.5 41.5 L79.8 38.9 L79.0 36.5 L78.2 34.1 L77.2 31.8 L76.2 29.6 L75.2 27.5 L74.1 25.4 L73.0 23.3 L71.8 21.4 L70.6 19.4 L69.3 17.6 L68.0 15.8 L66.7 14.0 L65.3 12.3 L63.9 10.6 L62.5 9.0 L61.0 7.5 L59.5 6.0 L58.0 4.5 L56.4 3.1 L54.9 1.8 L53.3 0.5 L51.6 -0.8 L50.0 -2.0 L48.3 -3.1 L46.6 -4.2 L44.9 -5.2 L43.2 -6.2 L41.4 -7.1 L39.7 -8.0 L37.9 -8.8 L36.1 -9.6 L34.3 -10.3 L32.5 -11.0 L30.7 -11.6 L28.9 -12.2 L27.1 -12.7 L25.3 -13.2 L23.5 -13.6 L21.8 -14.0 L20.0 -14.3 L18.2 -14.7 L16.5 -14.9 L14.7 -15.2 L13.0 -15.4 L11.3 -15.5 L9.6 -15.7 L7.9 -15.8 L6.3 -15.9 L4.7 -15.9 L3.1 -16.0 L1.5 -16.0 L0.0 -16.0 L0.0 -16.0 L-1.5 -16.0 L-3.1 -16.0 L-4.7 -15.9 L-6.3 -15.9 L-7.9 -15.8 L-9.6 -15.7 L-11.3 -15.5 L-13.0 -15.4 L-14.7 -15.2 L-16.5 -14.9 L-18.2 -14.7 L-20.0 -14.3 L-21.8 -14.0 L-23.5 -13.6 L-25.3 -13.2 L-27.1 -12.7 L-28.9 -12.2 L-30.7 -11.6 L-32.5 -11.0 L-34.3 -10.3 L-36.1 -9.6 L-37.9 -8.8 L-39.7 -8.0 L-41.4 -7.1 L-43.2 -6.2 L-44.9 -5.2 L-46.6 -4.2 L-48.3 -3.1 L-50.0 -2.0 L-51.6 -0.8 L-53.3 0.5 L-54.9 1.8 L-56.4 3.1 L-58.0 4.5 L-59.5 6.0 L-61.0 7.5 L-62.5 9.0 L-63.9 10.6 L-65.3 12.3 L-66.7 14.0 L-68.0 15.8 L-69.3 17.6 L-70.6 19.4 L-71.8 21.4 L-73.0 23.3 L-74.1 25.4 L-75.2 27.5 L-76.2 29.6 L-77.2 31.8 L-78.2 34.1 L-79.0 36.5 L-79.8 38.9 L-80.5 41.5 L-81.0 44.2 L-80.8 47.4 L-79.2 48.6 L-76.1 47.9 L-73.7 46.8 L-71.4 45.7 L-69.3 44.5 L-67.3 43.4 L-65.3 42.4 L-63.4 41.3 L-61.5 40.4 L-59.7 39.4 L-57.9 38.5 L-56.2 37.7 L-54.5 36.9 L-52.9 36.1 L-51.3 35.4 L-49.7 34.7 L-48.1 34.1 L-46.6 33.5 L-45.2 33.0 L-43.7 32.4 L-42.3 32.0 L-40.9 31.5 L-39.6 31.1 L-38.2 30.8 L-36.9 30.4 L-35.6 30.1 L-34.4 29.9 L-33.1 29.6 L-31.9 29.4 L-30.7 29.2 L-29.6 29.0 L-28.4 28.8 L-27.2 28.7 L-26.1 28.6 L-25.0 28.4 L-23.9 28.3 L-22.7 28.3 L-21.6 28.2 L-20.5 28.1 L-19.4 28.1 L-18.3 28.0 L-17.2 28.0 L-16.1 28.0 L-14.9 27.9 L-13.8 27.9 L-12.6 27.9 L-11.5 27.9 L-10.3 27.9 L-9.1 27.9 L-7.9 27.9 L-6.6 28.0 L-5.4 28.0 L-4.1 28.0 L-2.8 28.0 L-1.4 28.0 L0.0 28.0 Z M21.0 74.0 L21.5 75.7 L21.8 77.5 L21.7 79.3 L21.1 80.9 L20.1 82.5 L18.8 83.8 L17.3 85.0 L15.7 85.9 L14.1 86.8 L12.6 87.6 L11.2 88.5 L9.9 89.5 L8.5 90.5 L7.1 91.6 L5.5 92.7 L3.8 93.6 L1.9 94.1 L0.0 94.3 L-1.9 94.1 L-3.8 93.6 L-5.5 92.7 L-7.1 91.6 L-8.5 90.5 L-9.9 89.5 L-11.2 88.5 L-12.6 87.6 L-14.1 86.8 L-15.7 85.9 L-17.3 85.0 L-18.8 83.8 L-20.1 82.5 L-21.1 80.9 L-21.7 79.3 L-21.8 77.5 L-21.5 75.7 L-21.0 74.0 L-20.3 72.4 L-19.6 70.9 L-18.9 69.4 L-18.4 67.9 L-17.9 66.4 L-17.6 64.8 L-17.1 63.2 L-16.5 61.5 L-15.6 59.9 L-14.4 58.5 L-12.9 57.4 L-11.1 56.5 L-9.2 56.1 L-7.3 55.9 L-5.3 56.0 L-3.5 56.1 L-1.7 56.3 L-0.0 56.3 L1.7 56.3 L3.5 56.1 L5.3 56.0 L7.3 55.9 L9.2 56.1 L11.1 56.5 L12.9 57.4 L14.4 58.5 L15.6 59.9 L16.5 61.5 L17.1 63.2 L17.6 64.8 L17.9 66.4 L18.4 67.9 L18.9 69.4 L19.6 70.9 L20.3 72.4 Z"/>
</symbol>
<symbol id="fatmustache" class="template" viewBox="-104 -34 209 72">
<path d="M0.0 32.0 L1.7 32.0 L3.3 31.9 L4.9 31.9 L6.6 31.8 L8.2 31.7 L9.8 31.6 L11.4 31.5 L13.0 31.4 L14.6 31.3 L16.1 31.2 L17.7 31.1 L19.3 31.0 L20.9 30.9 L22.5 30.7 L24.1 30.6 L25.7 30.5 L27.3 30.3 L29.0 30.2 L30.6 30.1 L32.2 29.9 L33.8 29.8 L35.5 29.7 L37.1 29.5 L38.8 29.4 L40.4 29.3 L42.1 29.1 L43.7 29.0 L45.4 28.9 L47.1 28.7 L48.8 28.6 L50.5 28.5 L52.3 28.3 L54.0 28.2 L55.8 28.1 L57.5 28.0 L59.3 27.8 L61.1 27.7 L62.9 27.6 L64.7 27.4 L66.6 27.3 L68.4 27.2 L70.3 27.0 L72.2 26.9 L74.1 26.7 L76.0 26.6 L78.0 26.4 L80.0 26.2 L82.0 26.1 L84.0 25.9 L86.1 25.6 L88.2 25.4 L90.4 25.0 L92.6 24.6 L95.0 24.1 L97.6 22.9 L98.4 21.1 L97.5 18.3 L96.2 16.2 L94.9 14.3 L93.5 12.5 L92.1 10.8 L90.6 9.2 L89.0 7.6 L87.5 6.1 L85.9 4.6 L84.3 3.1 L82.7 1.7 L81.0 0.4 L79.4 -0.9 L77.7 -2.2 L76.0 -3.4 L74.3 -4.7 L72.5 -5.8 L70.8 -7.0 L69.0 -8.1 L67.2 -9.2 L65.4 -10.2 L63.6 -11.2 L61.8 -12.2 L59.9 -13.1 L58.1 -14.1 L56.2 -14.9 L54.4 -15.8 L52.5 -16.6 L50.6 -17.4 L48.7 -18.2 L46.8 -19.0 L44.9 -19.7 L42.9 -20.3 L41.0 -21.0 L39.1 -21.6 L37.1 -22.2 L35.2 -22.8 L33.2 -23.3 L31.3 -23.8 L29.3 -24.3 L27.4 -24.8 L25.4 -25.2 L23.4 -25.6 L21.5 -25.9 L19.5 -26.3 L17.5 -26.6 L15.5 -26.9 L13.6 -27.1 L11.6 -27.3 L9.7 -27.5 L7.7 -27.7 L5.8 -27.8 L3.8 -27.9 L1.9 -28.0 L0.0 -28.0 L0.0 -28.0 L-1.9 -28.0 L-3.8 -27.9 L-5.8 -27.8 L-7.7 -27.7 L-9.7 -27.5 L-11.6 -27.3 L-13.6 -27.1 L-15.5 -26.9 L-17.5 -26.6 L-19.5 -26.3 L-21.5 -25.9 L-23.4 -25.6 L-25.4 -25.2 L-27.4 -24.8 L-29.3 -24.3 L-31.3 -23.8 L-33.2 -23.3 L-35.2 -22.8 L-37.1 -22.2 L-39.1 -21.6 L-41.0 -21.0 L-42.9 -20.3 L-44.9 -19.7 L-46.8 -19.0 L-48.7 -18.2 L-50.6 -17.4 L-52.5 -16.6 L-54.4 -15.8 L-56.2 -14.9 L-58.1 -14.1 L-59.9 -13.1 L-61.8 -12.2 L-63.6 -11.2 L-65.4 -10.2 L-67.2 -9.2 L-69.0 -8.1 L-70.8 -7.0 L-72.5 -5.8 L-74.3 -4.7 L-76.0 -3.4 L-77.7 -2.2 L-79.4 -0.9 L-81.0 0.4 L-82.7 1.7 L-84.3 3.1 L-85.9 4.6 L-87.5 6.1 L-89.0 7.6 L-90.6 9.2 L-92.1 10.8 L-93.5 12.5 L-94.9 14.3 L-96.2 16.2 L-97.5 18.3 L-98.4 21.1 L-97.6 22.9 L-95.0 24.1 L-92.6 24.6 L-90.4 25.0 L-88.2 25.4 L-86.1 25.6 L-84.0 25.9 L-82.0 26.1 L-80.0 26.2 L-78.0 26.4 L-76.0 26.6 L-74.1 26.7 L-72.2 26.9 L-70.3 27.0 L-68.4 27.2 L-66.6 27.3 L-64.7 27.4 L-62.9 27.6 L-61.1 27.7 L-59.3 27.8 L-57.5 28.0 L-55.8 28.1 L-54.0 28.2 L-52.3 28.3 L-50.5 28.5 L-48.8 28.6 L-47.1 28.7 L-45.4 28.9 L-43.7 29.0 L-42.1 29.1 L-40.4 29.3 L-38.8 29.4 L-37.1 29.5 L-35.5 29.7 L-33.8 29.8 L-32.2 29.9 L-30.6 30.1 L-29.0 30.2 L-27.3 30.3 L-25.7 30.5 L-24.1 30.6 L-22.5 30.7 L-20.9 30.9 L-19.3 31.0 L-17.7 31.1 L-16.1 31.2 L-14.6 31.3 L-13.0 31.4 L-11.4 31.5 L-9.8 31.6 L-8.2 31.7 L-6.6 31.8 L-4.9 31.9 L-3.3 31.9 L-1.7 32.0 L0.0 32.0 Z"/>
</symbol>
<symbol id="handlebar" class="template" viewBox="-129 -37 257 61">
<path d="M0.0 16.6 L-0.7 16.8 L1.5 17.0 L3.8 17.1 L6.1 17.3 L8.4 17.5 L10.7 17.6 L13.0 17.8 L15.4 17.9 L17.7 18.0 L20.0 18.1 L22.4 18.2 L24.7 18.3 L27.1 18.4 L29.4 18.4 L31.8 18.5 L34.2 18.5 L36.6 18.4 L38.9 18.4 L41.3 18.3 L43.7 18.2 L46.1 18.1 L48.5 17.9 L50.9 17.7 L53.3 17.4 L55.7 17.1 L58.2 16.7 L60.6 16.3 L63.0 15.9 L65.4 15.4 L67.8 14.8 L70.2 14.2 L72.6 13.5 L75.0 12.7 L77.4 11.9 L79.8 11.0 L82.1 10.0 L84.5 8.9 L86.8 7.7 L89.2 6.5 L91.5 5.1 L93.8 3.7 L96.0 2.2 L98.3 0.5 L100.5 -1.3 L102.7 -3.1 L104.9 -5.1 L107.0 -7.2 L109.1 -9.5 L111.2 -11.9 L113.2 -14.4 L115.2 -17.0 L117.2 -19.9 L119.1 -22.9 L121.0 -26.0 L122.7 -29.5 L121.3 -30.5 L118.5 -27.9 L116.0 -25.4 L113.5 -23.1 L111.0 -20.9 L108.6 -18.9 L106.2 -17.1 L103.8 -15.4 L101.5 -13.9 L99.2 -12.5 L96.9 -11.3 L94.7 -10.2 L92.5 -9.2 L90.3 -8.3 L88.1 -7.5 L86.0 -6.8 L83.8 -6.2 L81.7 -5.6 L79.6 -5.2 L77.6 -4.8 L75.5 -4.5 L73.4 -4.3 L71.4 -4.1 L69.4 -3.9 L67.3 -3.9 L65.3 -3.9 L63.3 -3.9 L61.2 -3.9 L59.2 -4.1 L57.2 -4.2 L55.2 -4.4 L53.1 -4.6 L51.1 -4.9 L49.1 -5.2 L47.0 -5.5 L45.0 -5.9 L43.0 -6.2 L40.9 -6.6 L38.9 -7.1 L36.8 -7.5 L34.7 -8.0 L32.7 -8.5 L30.6 -9.0 L28.5 -9.5 L26.4 -10.0 L24.3 -10.6 L22.2 -11.2 L20.1 -11.7 L18.0 -12.3 L15.9 -12.9 L13.8 -13.5 L11.6 -14.1 L9.5 -14.8 L7.3 -15.4 L5.2 -16.0 L0.0 -16.6 L0.0 -16.6 L-5.2 -16.0 L-7.3 -15.4 L-9.5 -14.8 L-11.6 -14.1 L-13.8 -13.5 L-15.9 -12.9 L-18.0 -12.3 L-20.1 -11.7 L-22.2 -11.2 L-24.3 -10.6 L-26.4 -10.0 L-28.5 -9.5 L-30.6 -9.0 L-32.7 -8.5 L-34.7 -8.0 L-36.8 -7.5 L-38.9 -7.1 L-40.9 -6.6 L-43.0 -6.2 L-45.0 -5.9 L-47.0 -5.5 L-49.1 -5.2 L-51.1 -4.9 L-53.1 -4.6 L-55.2 -4.4 L-57.2 -4.2 L-59.2 -4.1 L-61.2 -3.9 L-63.3 -3.9 L-65.3 -3.9 L-67.3 -3.9 L-69.4 -3.9 L-71.4 -4.1 L-73.4 -4.3 L-75.5 -4.5 L-77.6 -4.8 L-79.6 -5.2 L-81.7 -5.6 L-83.8 -6.2 L-86.0 -6.8 L-88.1 -7.5 L-90.3 -8.3 L-92.5 -9.2 L-94.7 -10.2 L-96.9 -11.3 L-99.2 -12.5 L-101.5 -13.9 L-103.8 -15.4 L-106.2 -17.1 L-108.6 -18.9 L-111.0 -20.9 L-113.5 -23.1 L-116.0 -25.4 L-118.5 -27.9 L-121.3 -30.5 L-122.7 -29.5 L-121.0 -26.0 L-119.1 -22.9 L-117.2 -19.9 L-115.2 -17.0 L-113.2 -14.4 L-111.2 -11.9 L-109.1 -9.5 L-107.0 -7.2 L-104.9 -5.1 L-102.7 -3.1 L-100.5 -1.3 L-98.3 0.5 L-96.0 2.2 L-93.8 3.7 L-91.5 5.1 L-89.2 6.5 L-86.8 7.7 L-84.5 8.9 L-82.1 10.0 L-79.8 11.0 L-77.4 11.9 L-75.0 12.7 L-72.6 13.5 L-70.2 14.2 L-67.8 14.8 L-65.4 15.4 L-63.0 15.9 L-60.6 16.3 L-58.2 16.7 L-55.7 17.1 L-53.3 17.4 L-50.9 17.7 L-48.5 17.9 L-46.1 18.1 L-43.7 18.2 L-41.3 18.3 L-38.9 18.4 L-36.6 18.4 L-34.2 18.5 L-31.8 18.5 L-29.4 18.4 L-27.1 18.4 L-24.7 18.3 L-22.4 18.2 L-20.0 18.1 L-17.7 18.0 L-15.4 17.9 L-13.0 17.8 L-10.7 17.6 L-8.4 17.5 L-6.1 17.3 L-3.8 17.1 L-1.5 17.0 L0.7 16.8 L0.0 16.6 Z"/>
</symbol>
<symbol id="handlebarCurly" class="template" viewBox="-137 -36 274 69">
<path d="M0.0 13.1 L-1.4 14.2 L2.1 15.4 L5.7 16.5 L9.3 17.6 L12.9 18.7 L16.6 19.8 L20.3 20.8 L24.0 21.7 L27.7 22.6 L31.4 23.4 L35.2 24.1 L38.9 24.7 L42.7 25.3 L46.4 25.7 L50.2 26.1 L54.0 26.3 L57.8 26.4 L61.5 26.4 L65.3 26.4 L69.0 26.2 L72.7 25.9 L76.4 25.5 L80.0 25.0 L83.7 24.4 L87.3 23.8 L90.9 23.1 L94.5 22.3 L98.0 21.4 L101.5 20.5 L104.6 19.7 L110.0 18.7 L119.6 14.6 L127.2 6.5 L130.8 -3.6 L129.9 -13.9 L125.1 -22.6 L117.5 -28.4 L108.5 -30.5 L99.9 -28.8 L93.0 -23.9 L89.0 -16.9 L88.2 -9.3 L90.5 -2.4 L95.1 2.6 L101.1 5.1 L107.2 4.9 L112.3 2.3 L115.6 -1.9 L116.7 -6.6 L115.7 -11.0 L113.1 -14.2 L109.8 -15.7 L106.6 -15.6 L104.2 -14.1 L103.5 -12.1 L105.0 -10.8 L106.3 -11.2 L107.2 -11.1 L108.1 -10.6 L108.9 -9.8 L109.3 -8.6 L109.2 -7.2 L108.5 -5.8 L107.1 -4.8 L105.4 -4.3 L103.4 -4.5 L101.5 -5.7 L100.1 -7.6 L99.6 -10.1 L100.2 -12.8 L101.9 -15.2 L104.7 -16.7 L107.9 -17.1 L111.3 -16.0 L114.0 -13.5 L115.7 -10.0 L115.7 -5.9 L114.0 -2.0 L110.7 1.1 L105.3 2.9 L101.9 2.9 L98.1 3.5 L94.7 3.9 L91.4 4.3 L88.1 4.7 L84.8 4.9 L81.5 5.1 L78.3 5.3 L75.0 5.3 L71.9 5.3 L68.7 5.2 L65.5 5.0 L62.4 4.8 L59.3 4.4 L56.1 4.0 L53.0 3.4 L49.9 2.8 L46.8 2.1 L43.7 1.3 L40.6 0.5 L37.4 -0.5 L34.3 -1.5 L31.1 -2.5 L27.9 -3.7 L24.7 -4.9 L21.5 -6.2 L18.2 -7.5 L14.9 -8.9 L11.6 -10.2 L8.3 -11.7 L0.0 -13.1 L0.0 -13.1 L-8.3 -11.7 L-11.6 -10.2 L-14.9 -8.9 L-18.2 -7.5 L-21.5 -6.2 L-24.7 -4.9 L-27.9 -3.7 L-31.1 -2.5 L-34.3 -1.5 L-37.4 -0.5 L-40.6 0.5 L-43.7 1.3 L-46.8 2.1 L-49.9 2.8 L-53.0 3.4 L-56.1 4.0 L-59.3 4.4 L-62.4 4.8 L-65.5 5.0 L-68.7 5.2 L-71.9 5.3 L-75.0 5.3 L-78.3 5.3 L-81.5 5.1 L-84.8 4.9 L-88.1 4.7 L-91.4 4.3 L-94.7 3.9 L-98.1 3.5 L-101.9 2.9 L-105.3 2.9 L-110.7 1.1 L-114.0 -2.0 L-115.7 -5.9 L-115.7 -10.0 L-114.0 -13.5 L-111.3 -16.0 L-107.9 -17.1 L-104.7 -16.7 L-101.9 -15.2 L-100.2 -12.8 L-99.6 -10.1 L-100.1 -7.6 L-101.5 -5.7 L-103.4 -4.5 L-105.4 -4.3 L-107.1 -4.8 L-108.5 -5.8 L-109.2 -7.2 L-109.3 -8.6 L-108.9 -9.8 L-108.1 -10.6 L-107.2 -11.1 L-106.3 -11.2 L-105.0 -10.8 L-103.5 -12.1 L-104.2 -14.1 L-106.6 -15.6 L-109.8 -15.7 L-113.1 -14.2 L-115.7 -11.0 L-116.7 -6.6 L-115.6 -1.9 L-112.3 2.3 L-107.2 4.9 L-101.1 5.1 L-95.1 2.6 L-90.5 -2.4 L-88.2 -9.3 L-89.0 -16.9 L-93.0 -23.9 L-99.9 -28.8 L-108.5 -30.5 L-117.5 -28.4 L-125.1 -22.6 L-129.9 -13.9 L-130.8 -3.6 L-127.2 6.5 L-119.6 14.6 L-110.0 18.7 L-104.6 19.7 L-101.5 20.5 L-98.0 21.4 L-94.5 22.3 L-90.9 23.1 L-87.3 23.8 L-83.7 24.4 L-80.0 25.0 L-76.4 25.5 L-72.7 25.9 L-69.0 26.2 L-65.3 26.4 L-61.5 26.4 L-57.8 26.4 L-54.0 26.3 L-50.2 26.1 L-46.4 25.7 L-42.7 25.3 L-38.9 24.7 L-35.2 24.1 L-31.4 23.4 L-27.7 22.6 L-24.0 21.7 L-20.3 20.8 L-16.6 19.8 L-12.9 18.7 L-9.3 17.6 L-5.7 16.5 L-2.1 15.4 L1.4 14.2 L0.0 13.1 Z"/>
</symbol>
<symbol id="handlebarPointy" class="template" viewBox="-132 -38 265 66">
<path d="M0.0 21.5 L2.4 21.2 L4.7 20.9 L7.1 20.6 L9.5 20.2 L11.9 19.8 L14.3 19.5 L16.7 19.1 L19.1 18.6 L21.5 18.2 L23.9 17.7 L26.2 17.3 L28.6 16.7 L31.0 16.2 L33.4 15.6 L35.8 15.1 L38.1 14.5 L40.5 13.8 L42.9 13.2 L45.2 12.5 L47.6 11.8 L49.9 11.0 L52.3 10.2 L54.6 9.4 L56.9 8.6 L59.3 7.8 L61.6 6.9 L63.9 6.0 L66.2 5.0 L68.5 4.1 L70.8 3.1 L73.1 2.0 L75.3 1.0 L77.6 -0.1 L79.9 -1.2 L82.1 -2.4 L84.4 -3.5 L86.6 -4.8 L88.9 -6.0 L91.1 -7.3 L93.3 -8.5 L95.6 -9.9 L97.8 -11.2 L100.0 -12.6 L102.2 -14.0 L104.4 -15.5 L106.6 -17.0 L108.8 -18.5 L111.0 -20.0 L113.2 -21.6 L115.4 -23.2 L117.5 -24.8 L119.7 -26.5 L121.9 -28.2 L124.1 -29.9 L126.3 -31.6 L125.7 -32.4 L123.3 -31.0 L120.9 -29.6 L118.5 -28.3 L116.1 -27.1 L113.7 -25.9 L111.3 -24.7 L108.9 -23.6 L106.5 -22.5 L104.2 -21.4 L101.8 -20.4 L99.4 -19.5 L97.0 -18.5 L94.7 -17.6 L92.3 -16.8 L89.9 -16.0 L87.6 -15.2 L85.2 -14.5 L82.9 -13.8 L80.6 -13.1 L78.2 -12.5 L75.9 -11.9 L73.6 -11.4 L71.3 -10.8 L69.0 -10.4 L66.7 -9.9 L64.4 -9.5 L62.1 -9.1 L59.8 -8.8 L57.6 -8.4 L55.3 -8.2 L53.0 -7.9 L50.8 -7.7 L48.5 -7.5 L46.3 -7.3 L44.1 -7.2 L41.8 -7.1 L39.6 -7.0 L37.4 -6.9 L35.2 -6.9 L33.0 -6.9 L30.8 -6.9 L28.5 -7.0 L26.4 -7.0 L24.2 -7.1 L22.0 -7.2 L19.8 -7.4 L17.6 -7.5 L15.4 -7.7 L13.2 -7.9 L11.0 -8.2 L8.8 -8.4 L6.6 -8.6 L4.4 -8.9 L2.2 -9.2 L0.0 -9.5 L0.0 -9.5 L-2.2 -9.2 L-4.4 -8.9 L-6.6 -8.6 L-8.8 -8.4 L-11.0 -8.2 L-13.2 -7.9 L-15.4 -7.7 L-17.6 -7.5 L-19.8 -7.4 L-22.0 -7.2 L-24.2 -7.1 L-26.4 -7.0 L-28.5 -7.0 L-30.8 -6.9 L-33.0 -6.9 L-35.2 -6.9 L-37.4 -6.9 L-39.6 -7.0 L-41.8 -7.1 L-44.1 -7.2 L-46.3 -7.3 L-48.5 -7.5 L-50.8 -7.7 L-53.0 -7.9 L-55.3 -8.2 L-57.6 -8.4 L-59.8 -8.8 L-62.1 -9.1 L-64.4 -9.5 L-66.7 -9.9 L-69.0 -10.4 L-71.3 -10.8 L-73.6 -11.4 L-75.9 -11.9 L-78.2 -12.5 L-80.6 -13.1 L-82.9 -13.8 L-85.2 -14.5 L-87.6 -15.2 L-89.9 -16.0 L-92.3 -16.8 L-94.7 -17.6 L-97.0 -18.5 L-99.4 -19.5 L-101.8 -20.4 L-104.2 -21.4 L-106.5 -22.5 L-108.9 -23.6 L-111.3 -24.7 L-113.7 -25.9 L-116.1 -27.1 L-118.5 -28.3 L-120.9 -29.6 L-123.3 -31.0 L-125.7 -32.4 L-126.3 -31.6 L-124.1 -29.9 L-121.9 -28.2 L-119.7 -26.5 L-117.5 -24.8 L-115.4 -23.2 L-113.2 -21.6 L-111.0 -20.0 L-108.8 -18.5 L-106.6 -17.0 L-104.4 -15.5 L-102.2 -14.0 L-100.0 -12.6 L-97.8 -11.2 L-95.6 -9.9 L-93.3 -8.5 L-91.1 -7.3 L-88.9 -6.0 L-86.6 -4.8 L-84.4 -3.5 L-82.1 -2.4 L-79.9 -1.2 L-77.6 -0.1 L-75.3 1.0 L-73.1 2.0 L-70.8 3.1 L-68.5 4.1 L-66.2 5.0 L-63.9 6.0 L-61.6 6.9 L-59.3 7.8 L-56.9 8.6 L-54.6 9.4 L-52.3 10.2 L-49.9 11.0 L-47.6 11.8 L-45.2 12.5 L-42.9 13.2 L-40.5 13.8 L-38.1 14.5 L-35.8 15.1 L-33.4 15.6 L-31.0 16.2 L-28.6 16.7 L-26.2 17.3 L-23.9 17.7 L-21.5 18.2 L-19.1 18.6 L-16.7 19.1 L-14.3 19.5 L-11.9 19.8 L-9.5 20.2 L-7.1 20.6 L-4.7 20.9 L-2.4 21.2 L0.0 21.5 Z"/>
</symbol>
<symbol id="handlebarThick" class="template" viewBox="-102 -31 203 62">
<path d="M0.0 25.2 L1.5 25.0 L2.9 24.7 L4.4 24.5 L5.9 24.3 L7.3 24.2 L8.8 24.0 L10.3 23.8 L11.8 23.7 L13.3 23.6 L14.8 23.4 L16.4 23.3 L17.9 23.2 L19.4 23.2 L21.0 23.1 L22.5 23.0 L24.1 23.0 L25.7 23.0 L27.3 22.9 L28.9 22.9 L30.6 22.9 L32.2 22.9 L33.9 23.0 L35.6 23.0 L37.3 23.0 L39.1 23.1 L40.9 23.1 L42.7 23.1 L44.5 23.2 L46.4 23.2 L48.3 23.2 L50.3 23.2 L52.3 23.1 L54.3 23.1 L56.4 22.9 L58.6 22.8 L60.7 22.5 L63.0 22.2 L65.2 21.8 L67.5 21.3 L69.9 20.7 L72.2 19.9 L74.6 18.9 L77.0 17.8 L79.3 16.5 L81.5 14.9 L83.7 13.2 L85.7 11.2 L87.7 9.1 L89.4 6.7 L91.1 4.1 L92.5 1.2 L93.8 -1.8 L94.9 -5.2 L95.7 -8.9 L95.1 -13.4 L92.9 -14.6 L88.9 -12.6 L86.3 -10.6 L83.9 -8.8 L81.8 -7.4 L79.9 -6.3 L78.1 -5.4 L76.4 -4.8 L74.9 -4.4 L73.5 -4.2 L72.3 -4.1 L71.1 -4.2 L70.0 -4.3 L68.9 -4.5 L67.9 -4.7 L66.8 -5.0 L65.8 -5.4 L64.7 -5.7 L63.5 -6.1 L62.3 -6.6 L61.1 -7.0 L59.8 -7.5 L58.5 -8.1 L57.1 -8.6 L55.7 -9.2 L54.2 -9.8 L52.7 -10.4 L51.2 -11.1 L49.6 -11.7 L48.0 -12.4 L46.4 -13.0 L44.7 -13.7 L43.0 -14.3 L41.3 -15.0 L39.6 -15.6 L37.8 -16.2 L36.0 -16.9 L34.2 -17.5 L32.4 -18.1 L30.6 -18.6 L28.7 -19.2 L26.9 -19.7 L25.0 -20.3 L23.1 -20.8 L21.2 -21.3 L19.4 -21.7 L17.4 -22.2 L15.5 -22.6 L13.6 -23.0 L11.7 -23.4 L9.7 -23.7 L7.8 -24.1 L5.9 -24.4 L3.9 -24.7 L2.0 -24.9 L0.0 -25.2 L0.0 -25.2 L-2.0 -24.9 L-3.9 -24.7 L-5.9 -24.4 L-7.8 -24.1 L-9.7 -23.7 L-11.7 -23.4 L-13.6 -23.0 L-15.5 -22.6 L-17.4 -22.2 L-19.4 -21.7 L-21.2 -21.3 L-23.1 -20.8 L-25.0 -20.3 L-26.9 -19.7 L-28.7 -19.2 L-30.6 -18.6 L-32.4 -18.1 L-34.2 -17.5 L-36.0 -16.9 L-37.8 -16.2 L-39.6 -15.6 L-41.3 -15.0 L-43.0 -14.3 L-44.7 -13.7 L-46.4 -13.0 L-48.0 -12.4 L-49.6 -11.7 L-51.2 -11.1 L-52.7 -10.4 L-54.2 -9.8 L-55.7 -9.2 L-57.1 -8.6 L-58.5 -8.1 L-59.8 -7.5 L-61.1 -7.0 L-62.3 -6.6 L-63.5 -6.1 L-64.7 -5.7 L-65.8 -5.4 L-66.8 -5.0 L-67.9 -4.7 L-68.9 -4.5 L-70.0 -4.3 L-71.1 -4.2 L-72.3 -4.1 L-73.5 -4.2 L-74.9 -4.4 L-76.4 -4.8 L-78.1 -5.4 L-79.9 -6.3 L-81.8 -7.4 L-83.9 -8.8 L-86.3 -10.6 L-88.9 -12.6 L-92.9 -14.6 L-95.1 -13.4 L-95.7 -8.9 L-94.9 -5.2 L-93.8 -1.8 L-92.5 1.2 L-91.1 4.1 L-89.4 6.7 L-87.7 9.1 L-85.7 11.2 L-83.7 13.2 L-81.5 14.9 L-79.3 16.5 L-77.0 17.8 L-74.6 18.9 L-72.2 19.9 L-69.9 20.7 L-67.5 21.3 L-65.2 21.8 L-63.0 22.2 L-60.7 22.5 L-58.6 22.8 L-56.4 22.9 L-54.3 23.1 L-52.3 23.1 L-50.3 23.2 L-48.3 23.2 L-46.4 23.2 L-44.5 23.2 L-42.7 23.1 L-40.9 23.1 L-39.1 23.1 L-37.3 23.0 L-35.6 23.0 L-33.9 23.0 L-32.2 22.9 L-30.6 22.9 L-28.9 22.9 L-27.3 22.9 L-25.7 23.0 L-24.1 23.0 L-22.5 23.0 L-21.0 23.1 L-19.4 23.2 L-17.9 23.2 L-16.4 23.3 L-14.8 23.4 L-13.3 23.6 L-11.8 23.7 L-10.3 23.8 L-8.8 24.0 L-7.3 24.2 L-5.9 24.3 L-4.4 24.5 L-2.9 24.7 L-1.5 25.0 L0.0 25.2 Z"/>
</symbol>
<symbol id="zappaesce" class="template" viewBox="-118 -21 237 95">
<path d="M0.0 21.0 L2.0 21.0 L4.1 21.0 L6.1 21.0 L8.1 21.0 L10.1 21.0 L12.1 21.0 L14.1 21.0 L16.1 21.0 L18.1 21.0 L20.1 21.0 L22.1 21.0 L24.1 21.1 L26.0 21.1 L28.0 21.1 L30.0 21.1 L31.9 21.1 L33.9 21.2 L35.8 21.2 L37.8 21.2 L39.7 21.2 L41.7 21.3 L43.6 21.3 L45.5 21.4 L47.5 21.4 L49.4 21.5 L51.3 21.5 L53.3 21.6 L55.2 21.6 L57.1 21.7 L59.0 21.8 L61.0 21.8 L62.9 21.9 L64.8 22.0 L66.7 22.0 L68.7 22.1 L70.6 22.2 L72.6 22.3 L74.5 22.4 L76.5 22.4 L78.4 22.5 L80.4 22.6 L82.4 22.7 L84.4 22.7 L86.4 22.8 L88.4 22.9 L90.5 22.9 L92.6 23.0 L94.7 23.0 L96.8 23.0 L99.0 22.9 L101.3 22.8 L103.5 22.6 L105.9 22.3 L108.5 21.8 L111.6 19.9 L112.4 18.1 L111.5 14.5 L109.9 12.3 L108.2 10.4 L106.5 8.7 L104.6 7.1 L102.7 5.7 L100.8 4.3 L98.8 3.0 L96.8 1.8 L94.8 0.7 L92.8 -0.4 L90.7 -1.5 L88.7 -2.4 L86.6 -3.3 L84.5 -4.2 L82.4 -5.0 L80.3 -5.8 L78.1 -6.5 L76.0 -7.2 L73.9 -7.9 L71.7 -8.5 L69.6 -9.1 L67.4 -9.6 L65.3 -10.1 L63.2 -10.6 L61.0 -11.0 L58.9 -11.4 L56.7 -11.8 L54.6 -12.1 L52.4 -12.5 L50.3 -12.8 L48.1 -13.0 L46.0 -13.3 L43.9 -13.5 L41.7 -13.7 L39.6 -13.9 L37.5 -14.1 L35.3 -14.2 L33.2 -14.3 L31.1 -14.5 L29.0 -14.6 L26.9 -14.6 L24.8 -14.7 L22.7 -14.8 L20.6 -14.8 L18.5 -14.9 L16.5 -14.9 L14.4 -14.9 L12.3 -15.0 L10.2 -15.0 L8.2 -15.0 L6.1 -15.0 L4.1 -15.0 L2.0 -15.0 L0.0 -15.0 L0.0 -15.0 L-2.0 -15.0 L-4.1 -15.0 L-6.1 -15.0 L-8.2 -15.0 L-10.2 -15.0 L-12.3 -15.0 L-14.4 -14.9 L-16.5 -14.9 L-18.5 -14.9 L-20.6 -14.8 L-22.7 -14.8 L-24.8 -14.7 L-26.9 -14.6 L-29.0 -14.6 L-31.1 -14.5 L-33.2 -14.3 L-35.3 -14.2 L-37.5 -14.1 L-39.6 -13.9 L-41.7 -13.7 L-43.9 -13.5 L-46.0 -13.3 L-48.1 -13.0 L-50.3 -12.8 L-52.4 -12.5 L-54.6 -12.1 L-56.7 -11.8 L-58.9 -11.4 L-61.0 -11.0 L-63.2 -10.6 L-65.3 -10.1 L-67.4 -9.6 L-69.6 -9.1 L-71.7 -8.5 L-73.9 -7.9 L-76.0 -7.2 L-78.1 -6.5 L-80.3 -5.8 L-82.4 -5.0 L-84.5 -4.2 L-86.6 -3.3 L-88.7 -2.4 L-90.7 -1.5 L-92.8 -0.4 L-94.8 0.7 L-96.8 1.8 L-98.8 3.0 L-100.8 4.3 L-102.7 5.7 L-104.6 7.1 L-106.5 8.7 L-108.2 10.4 L-109.9 12.3 L-111.5 14.5 L-112.4 18.1 L-111.6 19.9 L-108.5 21.8 L-105.9 22.3 L-103.5 22.6 L-101.3 22.8 L-99.0 22.9 L-96.8 23.0 L-94.7 23.0 L-92.6 23.0 L-90.5 22.9 L-88.4 22.9 L-86.4 22.8 L-84.4 22.7 L-82.4 22.7 L-80.4 22.6 L-78.4 22.5 L-76.5 22.4 L-74.5 22.4 L-72.6 22.3 L-70.6 22.2 L-68.7 22.1 L-66.7 22.0 L-64.8 22.0 L-62.9 21.9 L-61.0 21.8 L-59.0 21.8 L-57.1 21.7 L-55.2 21.6 L-53.3 21.6 L-51.3 21.5 L-49.4 21.5 L-47.5 21.4 L-45.5 21.4 L-43.6 21.3 L-41.7 21.3 L-39.7 21.2 L-37.8 21.2 L-35.8 21.2 L-33.9 21.2 L-31.9 21.1 L-30.0 21.1 L-28.0 21.1 L-26.0 21.1 L-24.1 21.1 L-22.1 21.0 L-20.1 21.0 L-18.1 21.0 L-16.1 21.0 L-14.1 21.0 L-12.1 21.0 L-10.1 21.0 L-8.1 21.0 L-6.1 21.0 L-4.1 21.0 L-2.0 21.0 L0.0 21.0 Z M28.0 56.0 L29.3 57.1 L29.9 58.3 L29.4 59.4 L27.8 60.3 L25.6 61.1 L23.2 61.7 L21.1 62.3 L19.5 63.0 L18.5 63.9 L17.7 65.0 L16.7 66.2 L15.1 67.2 L12.9 67.9 L10.2 68.1 L7.4 67.9 L4.7 67.5 L2.3 67.1 L0.0 66.9 L-2.3 67.1 L-4.7 67.5 L-7.4 67.9 L-10.2 68.1 L-12.9 67.9 L-15.1 67.2 L-16.7 66.2 L-17.7 65.0 L-18.5 63.9 L-19.5 63.0 L-21.1 62.3 L-23.2 61.7 L-25.6 61.1 L-27.8 60.3 L-29.4 59.4 L-29.9 58.3 L-29.3 57.1 L-28.0 56.0 L-26.5 55.0 L-25.2 54.1 L-24.7 53.2 L-24.8 52.1 L-25.2 51.0 L-25.3 49.7 L-24.8 48.6 L-23.4 47.6 L-21.1 47.0 L-18.3 46.7 L-15.4 46.5 L-12.9 46.4 L-10.8 46.1 L-8.9 45.5 L-7.1 44.7 L-5.0 43.8 L-2.6 43.2 L-0.0 42.9 L2.6 43.2 L5.0 43.8 L7.1 44.7 L8.9 45.5 L10.8 46.1 L12.9 46.4 L15.4 46.5 L18.3 46.7 L21.1 47.0 L23.4 47.6 L24.8 48.6 L25.3 49.7 L25.2 51.0 L24.8 52.1 L24.7 53.2 L25.2 54.1 L26.5 55.0 Z"/>
</symbol>
<symbol id="handlebarWavy" class="template" viewBox="-130 -22 261 45">
<path d="M0.0 13.8 L0.0 13.8 L1.4 13.9 L3.3 14.2 L5.4 14.6 L7.7 15.1 L10.2 15.5 L12.8 16.0 L15.5 16.5 L18.3 16.8 L21.2 17.0 L24.2 17.0 L27.2 16.9 L30.3 16.6 L33.3 16.0 L36.2 15.2 L39.0 14.3 L41.8 13.2 L44.4 12.0 L46.9 10.7 L49.3 9.4 L51.6 8.1 L53.8 6.7 L56.0 5.4 L58.0 4.2 L59.9 3.1 L61.8 2.1 L63.6 1.2 L65.2 0.5 L66.9 -0.1 L68.4 -0.6 L70.0 -0.9 L71.6 -1.1 L73.2 -1.1 L74.9 -0.9 L76.7 -0.6 L78.6 -0.1 L80.6 0.5 L82.8 1.4 L85.0 2.4 L87.2 3.5 L89.6 4.8 L91.9 6.1 L94.4 7.3 L96.8 8.6 L99.4 9.8 L101.9 10.9 L104.5 11.8 L107.1 12.5 L109.7 13.0 L112.3 13.2 L114.9 13.1 L117.4 12.7 L119.8 12.1 L122.2 11.1 L124.3 9.7 L123.7 8.1 L121.3 8.3 L119.1 8.5 L117.1 8.4 L115.1 8.1 L113.1 7.7 L111.2 7.0 L109.3 6.1 L107.4 5.0 L105.5 3.8 L103.5 2.5 L101.6 1.0 L99.5 -0.6 L97.4 -2.3 L95.3 -4.0 L93.1 -5.7 L90.9 -7.4 L88.6 -9.0 L86.2 -10.6 L83.7 -12.0 L81.1 -13.3 L78.4 -14.3 L75.6 -15.2 L72.7 -15.8 L69.8 -16.1 L66.8 -16.1 L63.9 -15.9 L61.0 -15.5 L58.2 -14.9 L55.5 -14.1 L52.8 -13.2 L50.2 -12.3 L47.7 -11.3 L45.4 -10.4 L43.1 -9.4 L40.9 -8.6 L38.7 -7.9 L36.8 -7.3 L34.9 -6.8 L33.1 -6.4 L31.4 -6.2 L29.9 -6.1 L28.3 -6.1 L26.9 -6.2 L25.4 -6.5 L23.9 -6.8 L22.3 -7.2 L20.6 -7.7 L18.8 -8.4 L16.9 -9.1 L14.8 -9.8 L12.6 -10.7 L10.2 -11.6 L7.6 -12.4 L4.5 -13.2 L0.0 -13.8 L0.0 -13.8 L-4.5 -13.2 L-7.6 -12.4 L-10.2 -11.6 L-12.6 -10.7 L-14.8 -9.8 L-16.9 -9.1 L-18.8 -8.4 L-20.6 -7.7 L-22.3 -7.2 L-23.9 -6.8 L-25.4 -6.5 L-26.9 -6.2 L-28.3 -6.1 L-29.9 -6.1 L-31.4 -6.2 L-33.1 -6.4 L-34.9 -6.8 L-36.8 -7.3 L-38.7 -7.9 L-40.9 -8.6 L-43.1 -9.4 L-45.4 -10.4 L-47.7 -11.3 L-50.2 -12.3 L-52.8 -13.2 L-55.5 -14.1 L-58.2 -14.9 L-61.0 -15.5 L-63.9 -15.9 L-66.8 -16.1 L-69.8 -16.1 L-72.7 -15.8 L-75.6 -15.2 L-78.4 -14.3 L-81.1 -13.3 L-83.7 -12.0 L-86.2 -10.6 L-88.6 -9.0 L-90.9 -7.4 L-93.1 -5.7 L-95.3 -4.0 L-97.4 -2.3 L-99.5 -0.6 L-101.6 1.0 L-103.5 2.5 L-105.5 3.8 L-107.4 5.0 L-109.3 6.1 L-111.2 7.0 L-113.1 7.7 L-115.1 8.1 L-117.1 8.4 L-119.1 8.5 L-121.3 8.3 L-123.7 8.1 L-124.3 9.7 L-122.2 11.1 L-119.8 12.1 L-117.4 12.7 L-114.9 13.1 L-112.3 13.2 L-109.7 13.0 L-107.1 12.5 L-104.5 11.8 L-101.9 10.9 L-99.4 9.8 L-96.8 8.6 L-94.4 7.3 L-91.9 6.1 L-89.6 4.8 L-87.2 3.5 L-85.0 2.4 L-82.8 1.4 L-80.6 0.5 L-78.6 -0.1 L-76.7 -0.6 L-74.9 -0.9 L-73.2 -1.1 L-71.6 -1.1 L-70.0 -0.9 L-68.4 -0.6 L-66.9 -0.1 L-65.2 0.5 L-63.6 1.2 L-61.8 2.1 L-59.9 3.1 L-58.0 4.2 L-56.0 5.4 L-53.8 6.7 L-51.6 8.1 L-49.3 9.4 L-46.9 10.7 L-44.4 12.0 L-41.8 13.2 L-39.0 14.3 L-36.2 15.2 L-33.3 16.0 L-30.3 16.6 L-27.2 16.9 L-24.2 17.0 L-21.2 17.0 L-18.3 16.8 L-15.5 16.5 L-12.8 16.0 L-10.2 15.5 L-7.7 15.1 L-5.4 14.6 L-3.3 14.2 L-1.4 13.9 L-0.0 13.8 L0.0 13.8 Z"/>
</symbol>
</g>
<style>
.pitem { fill: white; stroke: black; fill-opacity: 0.5 }
.button:hover { stroke: cyan; stroke-width: 2px }
.button:active { stroke: black; fill-opacity: 0.3 }
.item { fill: black; fill-opacity: 1}
.active { stroke: hsl(210, 88%, 90%); stroke-width: 1px; stroke-dasharray: 2 }
.btext { fill: white; stroke: none; font: 7px sans-serif; text-anchor: middle; }
symbol path { vector-effect: non-scaling-stroke }
#palette, #decorations { touch-action: none; cursor: grab }
</style>
<script><![CDATA[
function $(id) { return document.getElementById(id); }
function init() {
var b = new BeardEnhancer("palette", "area");
b.init();
var paletteSensor = new sw.widgets.Sensor("activearea");
function updateSensor(evt) {
paletteSensor.setControlPoint({
x: evt.clientX,
y: evt.clientY
});
}
document.addEventListener("pointermove", updateSensor, false);
document.addEventListener("pointerdown", updateSensor, false);
var showPaletteAnim =
new sw.animation.Animate("palette", {
txf: {
to: {ty: -100},
template: "translate(0,#ty)"
}
},
0.3, yui.util.Easing.easeOut);
var hidePaletteAnim =
new sw.animation.Animate("palette", {
txf: {
to: {ty: 0},
template: "translate(0,#ty)"
}
},
0.3, yui.util.Easing.easeOut);
paletteSensor.events.onEnter.subscribe(function () {
hidePaletteAnim.stop();
showPaletteAnim.animate();
});
paletteSensor.events.onLeave.subscribe(function () {
showPaletteAnim.stop();
hidePaletteAnim.animate();
});
}
window.gfocused = null;
function BeardEnhancer(container, rect) {
var num_lines = 2;
var parser = new DOMParser();
var container = $(container);
var area = $(rect);
var focused = null;
var saveEnabled = false;
var getTemplates = function() {
var ctx = $('templates');
return ctx.getElementsByClassName("template");
};
var cloneElm = function(e) {
// The listener is on the palette item, so this also works when the
// press lands on the rounded background behind the shape.
var use = e.currentTarget.getElementsByTagNameNS(sw.svgNS, "use")[0];
var clone = use.cloneNode(false);
// Palette items are small. Place shapes at a size that suits the face.
clone.setAttribute("width", 210);
clone.setAttribute("height", 110);
var point = document.documentElement.createSVGPoint();
point.x = e.clientX;
point.y = e.clientY;
var uu = point.matrixTransform(document.documentElement.getScreenCTM().inverse());
// center around cursor
clone.x.baseVal.value = -clone.width.baseVal.value / 2;
clone.y.baseVal.value = -clone.height.baseVal.value / 2;
// translate
clone.setAttribute("transform", "translate(" + uu.x + " " + uu.y +")");
clone.dropPoint = uu;
return document.getElementById('decorations').appendChild(clone);
};
var addIndex = 0;
/* Keyboard route: add the next shape on the upper lip of the face. */
var addNext = function() {
var uses = container.getElementsByTagNameNS(sw.svgNS, "use");
var clone = uses[addIndex % uses.length].cloneNode(false);
addIndex++;
clone.setAttribute("width", 210);
clone.setAttribute("height", 110);
clone.x.baseVal.value = -clone.width.baseVal.value / 2;
clone.y.baseVal.value = -clone.height.baseVal.value / 2;
clone.setAttribute("transform", "translate(400 366)");
document.getElementById('decorations').appendChild(clone);
var item = new DragObject(clone, api);
item.pos = {x: 400, y: 366};
if(window.gfocused)
window.gfocused.setActive(false);
item.setActive(true);
window.gfocused = item;
};
var photoData = null;
var api = {
handleEvent : function(e) {
switch(e.type) {
case "click":
if(e.target === $("image"))
{
if(window.gfocused)
{
window.gfocused.setActive(false);
window.gfocused = null;
}
}
break;
case "pointerdown":
{
e.preventDefault();
var elm = cloneElm(e);
var new_focused = new DragObject(elm, this);
new_focused.pos = elm.dropPoint;
new_focused.dragging = true;
if(window.gfocused)
window.gfocused.setActive(false);
new_focused.setActive(true);
window.gfocused = new_focused;
}
break;
case "keydown":
// Arrow and delete keys no longer fire keypress.
if(e.key === "m" || e.key === "M") {
addNext();
e.preventDefault();
break;
}
switch(e.keyCode)
{
case 8: // backspace
case 46: // delete
if(window.gfocused) {
var old_focused_elm = window.gfocused.elm;
window.gfocused.setActive(false);
window.gfocused = null;
old_focused_elm.parentNode.removeChild(old_focused_elm);
}
e.preventDefault();
break;
case 38: // up-arrow
if(window.gfocused) {
window.gfocused.zoomIn(e.shiftKey ? 1.1 : null);
e.preventDefault();
}
break;
case 40: // dn-arrow
if(window.gfocused) {
window.gfocused.zoomOut(e.shiftKey ? 0.9 : null);
e.preventDefault();
}
break;
case 39: // right-arrow
if(window.gfocused) {
window.gfocused.rotateClockwise(e.shiftKey ? 2 : null);
e.preventDefault();
}
break;
case 37: // left-arrow
if(window.gfocused) {
window.gfocused.rotateCounterClockwise(e.shiftKey ? 2 : null);
e.preventDefault();
}
break;
default:
break;
}
break;
}
},
init : function() {
// add keyhandler
document.documentElement.addEventListener("keydown", this, false);
$("image").addEventListener("click", this, false);
// layout templates
var w = area.width.baseVal.value;
var h = area.height.baseVal.value;
var xpos = area.x.baseVal.value;
var ypos = area.y.baseVal.value;
var items = getTemplates();
var numitems = items.length;
var delta = (w - 10) / Math.ceil(numitems / num_lines);
var iw = delta - 10;
var ih = (h - 30) / num_lines;
var itemstr = "<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" transform=\"translate(" + (xpos-10) + " " + ypos + ")\">";
var line = 0;
var dx = xpos;
var dy = 10;
var deltay = ih + 10;
for(var i = 0; i < numitems; i++, dx+=delta)
{
if(i == Math.ceil(numitems/num_lines)) {
dy += deltay;
dx = xpos;
}
var item = items[i];
var url = "#" + item.id;
itemstr += "<g class=\"pitem tpl\">\n\t<rect x=\"" + dx + "\" y=\"" + dy + "\" width=\"" + iw + "\" height=\"" + ih + "\" rx=\"10\"/>\n";
itemstr += "\t<use class=\"item\" xlink:href=\"" + url + "\" transform=\"translate(" + dx + " " + dy + ")\" width=\"" + iw + "\" height=\"" + ih + "\"/>\n</g>";
}
// add replace photo button
itemstr += "<g id=\"replace\" class=\"pitem button\">\n\t<rect x=\"" + dx + "\" y=\"" + dy + "\" width=\"" + (iw/2-5) + "\" height=\"" + ih + "\" rx=\"10\"/>\n";
itemstr += "\t<path style=\"fill:white;stroke:none\" transform=\"translate(" + (dx+iw/4-11) + " " + (dy+3) + ")\" d=\"M2 6 H7 L9 3 H13 L15 6 H20 V18 H2 Z M11 8 A4 4 0 1 0 11 16 A4 4 0 1 0 11 8 Z\" fill-rule=\"evenodd\"/>";
itemstr += "\t<text y=\"30\" class=\"btext\" transform=\"translate(" + (dx+iw/4) + " " + dy + ")\" >Add photo</text>\n</g>";
// add save button
dx+= iw/2+5;
itemstr += "<g id=\"save\" class=\"pitem button\">\n\t<rect x=\"" + dx + "\" y=\"" + dy + "\" width=\"" + (iw/2-5) + "\" height=\"" + ih + "\" rx=\"10\"/>\n";
itemstr += "\t<path style=\"fill:white;stroke:none\" transform=\"translate(" + (dx+iw/4-11) + " " + (dy+3) + ")\" d=\"M9 2 H13 V10 H18 L11 17 L4 10 H9 Z M3 18 H19 V21 H3 Z\"/>";
itemstr += "\t<text y=\"30\" class=\"btext\" transform=\"translate(" + (dx+iw/4) + " " + dy + ")\" >Save</text>\n</g>";
itemstr += "</g>";
var tree = parser.parseFromString(itemstr, "application/xml");
// adoptnode required in webkit
container.appendChild(document.adoptNode(tree.documentElement));
var templates = document.getElementsByClassName("pitem tpl");
for(var i = 0; i < templates.length; i++)
{
templates[i].addEventListener("pointerdown", this, false);
}
document.getElementById("save").addEventListener("click", this.save, false);
document.getElementById("replace").addEventListener("click", this.replacePhoto, false);
},
/* Downloads the result as a standalone SVG. The original opened a
data: URL in a new window, which browsers now block. */
save: function() {
var s = new XMLSerializer();
function finish(imagelink) {
var exportstr = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 600" style="background:black">\n';
exportstr += '\t<defs>\n\t\t' + s.serializeToString(document.getElementById("templates")) + '</defs>\n';
exportstr += '\t<image xlink:href="' + imagelink + '" width="100%" height="100%"/>\n';
exportstr += '\t' + s.serializeToString(document.getElementById("decorations")) + '\n';
exportstr += '</svg>';
var url = URL.createObjectURL(new Blob([exportstr], {type: "image/svg+xml"}));
var link = document.createElementNS(sw.xhtmlNS, "a");
link.href = url;
link.download = "mustache.svg";
document.documentElement.appendChild(link);
link.click();
document.documentElement.removeChild(link);
setTimeout(function () { URL.revokeObjectURL(url); }, 10000);
}
if(photoData) {
finish(photoData);
} else {
fetch("face.svg").then(function (r) { return r.text(); }).then(function (text) {
finish("data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(text))));
});
}
},
/* Lets the visitor pick a picture from their own device. It stays
in the page and is never uploaded. */
replacePhoto: function() {
var input = document.createElementNS(sw.xhtmlNS, "input");
input.type = "file";
input.accept = "image/*";
input.addEventListener("change", function () {
if(!input.files.length)
return;
var reader = new FileReader();
reader.onload = function () {
photoData = reader.result;
document.getElementById("image").href.baseVal = photoData;
};
reader.readAsDataURL(input.files[0]);
}, false);
input.click();
}
};
return api;
}
function drawPos(e)
{
var uu = toUserUnits(e.target, e);
var str = "clientXY: " + e.clientX + "," + e.clientY + " uu: " + uu.x + "," + uu.y;
$('t').textContent = str;
}
]]></script>
</defs>
<image id="image" xlink:href="face.svg" width="100%" height="100%"/>
<rect id="activearea" y="500" width="100%" height="100" fill="none"/>
<g id="palette">
<rect id="area" rx="10" x="20" y="600" width="760" height="100" fill-opacity="0.8"/>
</g>
<g id="decorations"/>
</svg>
/mustache/simple_drag.js
/** =======================================================================
* Erik Dahlstrom
* License terms: see svg-wow.org
* CC0 http://creativecommons.org/publicdomain/zero/1.0/
* ======================================================================= */
/**
* A basic drag class.
*
* Modified copy for the restored demo: pointer events (mouse and touch), a
* separate dragging flag, classList, and a guard for items never moved.
*/
function DragObject(elm, parentobj)
{
this.elm = elm;
this.pos = null;
this.scale = 1;
this.rotation = 0;
this.active = false;
this.parent = parentobj;
this.dragging = false;
this.elm.addEventListener("pointerdown", this, false);
document.documentElement.addEventListener("pointermove", this, false);
document.documentElement.addEventListener("pointerup", this, false);
document.documentElement.addEventListener("pointercancel", this, false);
}
DragObject.prototype.setActive = function(isactive) {
this.active = isactive;
if(this.active)
this.elm.classList.add("active");
else
this.elm.classList.remove("active");
if(window.gfocused)
{
if(window.gfocused != this && isactive)
{
window.gfocused.setActive(false);
}
window.gfocused = isactive ? this : null;
}
else if(isactive)
{
window.gfocused = this;
}
}
DragObject.prototype.zoomIn = function(val) {
this.scale *= val ? val : 1.5;
this.setPosition(this.pos);
}
DragObject.prototype.zoomOut = function(val) {
this.scale *= val ? val : 0.75;
this.setPosition(this.pos);
}
DragObject.prototype.rotateClockwise = function(val) {
this.rotation += val ? val : 10;
this.setPosition(this.pos);
}
DragObject.prototype.rotateCounterClockwise = function(val) {
this.rotation -= val ? val : 10;
this.setPosition(this.pos);
}
DragObject.prototype.handleEvent = function(e)
{
switch(e.type)
{
case "mouseover":
return this.mouseover(e);
case "pointerdown":
return this.mousedown(e);
case "pointermove":
return this.mousemove(e);
case "pointerup":
case "pointercancel":
return this.mouseup(e);
}
}
DragObject.prototype.mousedown = function(e)
{
if(this.parent.active != null && this.parent.active != this)
this.parent.active.setActive(false);
e.preventDefault();
e.stopPropagation();
this.setActive(true);
this.dragging = true;
this.elm.parentNode.appendChild(this.elm);
this.dispatchEvent("dragstart");
}
DragObject.prototype.mouseup = function(e)
{
if(this.dragging)
this.dispatchEvent("dragend");
this.dragging = false;
}
DragObject.prototype.mouseover = function(e)
{
}
DragObject.prototype.mousemove = function(e)
{
if(this.dragging)
{
var uu = toUserUnits(this.elm, e);
this.setPosition(uu);
}
return false;
}
DragObject.prototype.dispatchEvent = function(eventname)
{
function dispatchInternal(fn)
{
if(fn && fn[eventname])
fn[eventname](this);
};
if("Array" == classOf(this.listeners))
{
for(var i=0; i < this.listeners.length; i++)
{
dispatchInternal(this.listeners[i]);
}
}
else
{
dispatchInternal(this.listeners);
}
}
DragObject.prototype.setPosition = function(uu)
{
this.pos = uu;
this.dispatchEvent("drag");
this.elm.setAttribute("transform", "translate("+uu.x + " " + uu.y + ") scale(" + this.scale + ") translate("+ (-uu.x) + " " + (-uu.y) + ") rotate(" + this.rotation + " " + uu.x + " " + uu.y + ") translate("+uu.x + " " + uu.y + ")");
}
function $(id) { return document.getElementById(id); }
/**
* Utility method for determining the class of an object.
*/
function classOf(o) {
if (undefined === o)
return "Undefined";
if (null === o)
return "Null";
return {}.toString.call(o).slice(8, -1);
}
/**
* Convert the event coordinates to user units for the given node
* @param node The node
* @param e The Event object (as given from e.g an onclick handler)
*/
function toUserUnits(node, e)
{
var point = document.documentElement.createSVGPoint();
point.x = e.clientX;
point.y = e.clientY;
var refelm = node;
if(refelm != document.documentElement)
refelm = node.parentNode;
return point.matrixTransform(refelm.getScreenCTM().inverse());
}
/mustache/face.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600" viewBox="0 0 800 600">
<title>Cartoon face</title>
<desc>An original cartoon of a round-faced person with short dark hair, big ears and a striped sweater, in front of a sunny hill. Drawn for this restoration.</desc>
<defs>
<linearGradient id="sky" x2="0" y2="1"><stop offset="0" stop-color="#57c2d6"/><stop offset="1" stop-color="#d9f2e4"/></linearGradient>
<radialGradient id="skin" cx=".42" cy=".36" r=".75"><stop offset="0" stop-color="#ffdcb8"/><stop offset=".7" stop-color="#f5bd8e"/><stop offset="1" stop-color="#e49f70"/></radialGradient>
<clipPath id="sweater"><path d="M120 600 C130 500 250 452 400 452 C550 452 670 500 680 600 Z"/></clipPath>
</defs>
<rect width="800" height="600" fill="url(#sky)"/>
<circle cx="660" cy="104" r="56" fill="#ffe27a"/>
<g fill="#fff" opacity=".85">
<ellipse cx="150" cy="104" rx="70" ry="22"/><ellipse cx="196" cy="88" rx="44" ry="24"/>
<ellipse cx="560" cy="210" rx="52" ry="15"/>
</g>
<path d="M0 470 C160 390 300 430 430 450 C580 470 700 400 800 430 V600 H0 Z" fill="#7cc36a"/>
<path d="M0 530 C200 480 420 540 800 500 V600 H0 Z" fill="#5fa957"/>
<path d="M120 600 C130 500 250 452 400 452 C550 452 670 500 680 600 Z" fill="#d9483b"/>
<g clip-path="url(#sweater)" fill="#f7efe1">
<rect x="100" y="486" width="600" height="20"/><rect x="100" y="530" width="600" height="20"/><rect x="100" y="574" width="600" height="20"/>
</g>
<path d="M340 420 H460 V470 C440 494 360 494 340 470 Z" fill="#e8aa7c"/>
<ellipse cx="226" cy="290" rx="34" ry="48" fill="#eeb083"/><ellipse cx="574" cy="290" rx="34" ry="48" fill="#eeb083"/>
<ellipse cx="228" cy="292" rx="16" ry="27" fill="#d98f64"/><ellipse cx="572" cy="292" rx="16" ry="27" fill="#d98f64"/>
<path d="M236 250 C236 140 310 96 400 96 C490 96 564 140 564 250 C564 372 486 456 400 456 C314 456 236 372 236 250 Z" fill="url(#skin)"/>
<path d="M232 256 C214 150 286 70 402 70 C520 70 588 150 568 256 C556 214 532 184 498 170 C440 196 340 194 296 166 C266 186 244 214 232 256 Z" fill="#33272a"/>
<path d="M300 118 C340 96 400 92 446 104" fill="none" stroke="#5b474a" stroke-width="7" stroke-linecap="round"/>
<path d="M296 234 C316 218 344 218 362 232 M438 232 C456 218 484 218 504 234" fill="none" stroke="#33272a" stroke-width="11" stroke-linecap="round"/>
<ellipse cx="330" cy="272" rx="25" ry="28" fill="#fff"/><ellipse cx="470" cy="272" rx="25" ry="28" fill="#fff"/>
<circle cx="336" cy="276" r="13" fill="#2f5d7c"/><circle cx="476" cy="276" r="13" fill="#2f5d7c"/>
<circle cx="338" cy="277" r="6.5" fill="#16181d"/><circle cx="478" cy="277" r="6.5" fill="#16181d"/>
<circle cx="342" cy="271" r="3" fill="#fff"/><circle cx="482" cy="271" r="3" fill="#fff"/>
<path d="M400 286 C386 318 376 336 386 344 C396 351 412 351 420 342" fill="none" stroke="#c97f58" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
<ellipse cx="290" cy="340" rx="28" ry="17" fill="#f39b86" opacity=".55"/><ellipse cx="510" cy="340" rx="28" ry="17" fill="#f39b86" opacity=".55"/>
<path d="M348 392 C376 416 426 416 452 392" fill="none" stroke="#a34a3e" stroke-width="8" stroke-linecap="round"/>
</svg>
/res/2.0/scripts/widgets/sensor.js
/** =======================================================================
* Vincent Hardy
* License terms: see svg-wow.org
* CC0 http://creativecommons.org/publicdomain/zero/1.0/
* ======================================================================= */
sw.widgets = sw.widgets || {};
yui = YAHOO;
/**
* An <code>Sensor</code> which computes an intensity along the x and y axis
* based on the distance between its sensor element and a control point
* (typically followin the mouse mouvements). The intensity is at 1 in the
* center and zero on the edges.
*
* Example:
* <code>
* var sensor = new sw.widgets.Sensor(sensorElt);
*
* sensor.events.onIntensityUpdate.subscribe(function (type, args) {
* var x = args[0].x;
* var y = args[0].y
* });
* function onMouseMove (event) {
* sensor.setControlPoint({x: event.clientX, y: event.clientY});
* }
*
* </code>
*
* @param p_sensor an <code>Element</code> or element id. This element's
* bounds define the sensor area.
* @param p_oIntensityFunctions with x and y functions to interpolate the values
* in the [0, 1] range.
*/
sw.widgets.Sensor = function (p_sensor, p_oIntensityFunctions) {
this.initialize(p_sensor, p_oIntensityFunctions);
};
sw.widgets.Sensor.prototype = {
/**
* @param p_sensor an <code>Element</code> or element id. This element's
* bounds define the sensor area.
* @param p_oIntensityFunctions with x and y functions to interpolate the
* values in the [0, 1] range.
*/
initialize : function (p_sensor, p_oIntensityFunctions) {
var sensor = sw.stringToElement(p_sensor);
this.element = sensor;
var curIntensity = {
x: 0,
y: 0,
out: {
x: true,
y: true
},
isOut: true
};
var previousIntensity = {
x: 0,
y: 0,
isOut: true
};
var speedFunctions = {
x: function (x) { return x; },
y: function (y) { return y; }
};
if (p_oIntensityFunctions !== undefined &&
p_oIntensityFunctions !== null) {
if (typeof p_oIntensityFunctions.x === "function") {
speedFunctions.x = p_oIntensityFunctions.x;
}
if (typeof p_oIntensityFunctions.y === "function") {
speedFunctions.y = p_oIntensityFunctions.y;
}
}
this.events = {};
this.events.onIntensityUpdate =
new YAHOO.util.CustomEvent(this.INTENSITY_UPDATE);
this.events.onEnter =
new YAHOO.util.CustomEvent(this.ENTER);
this.events.onLeave =
new YAHOO.util.CustomEvent(this.LEAVE);
/**
* Computes the intensity along an axis.
*
* @param xOrY the axis name
* @param ref the reference point
* @param ctrl the control point
* @param hLength the sensor half length along the axis
*/
function computeAxisIntensity (xOrY, ref, ctrl, hLength) {
var i = (ctrl - ref) / hLength;
if (i > 1) {
i = 1;
curIntensity.out[xOrY] = true;
} else if (i < -1) {
i = -1;
curIntensity.out[xOrY] = true;
} else {
curIntensity.out[xOrY] = false;
}
curIntensity[xOrY] = i;
}
/**
* Computes the current speed. The speed is normalized to the [0, 1]
* interval.
*
* @param p_ctrl the control points to measure distance against the
* reference point.
*/
this.setControlPoint = function (p_ctrl) {
var ictm = sensor.getScreenCTM().inverse();
var bounds = sensor.getBBox();
// ref is in the coordinate systme of the sensor element
var ref = {
x: bounds.x + bounds.width / 2,
y: bounds.y + bounds.height /2
};
// ctrl is now in the same coordinate system as the sensor element
var ctrl = ictm.transformPoint(p_ctrl);
computeAxisIntensity("x", ref.x, ctrl.x, bounds.width / 2);
computeAxisIntensity("y", ref.y, ctrl.y, bounds.height / 2);
curIntensity.isOut = curIntensity.out.x || curIntensity.out.y;
curIntensity.x = speedFunctions.x(curIntensity.x, curIntensity.y);
curIntensity.y = speedFunctions.y(curIntensity.y, curIntensity.x);
if (curIntensity.isOut) {
// We are out. Generate a LEAVE event if we were not out
// before.
if (!previousIntensity.isOut) {
this.events.onLeave.fire();
}
} else {
if (previousIntensity.isOut) {
// We just re-entered the sensor
this.events.onEnter.fire();
}
this.events.onIntensityUpdate.fire(curIntensity);
}
previousIntensity.x = curIntensity.x;
previousIntensity.y = curIntensity.y;
previousIntensity.isOut = curIntensity.isOut;
};
},
// Constants
INTENSITY_UPDATE: "INTENSITY_UPDATE",
LEAVE: "LEAVE",
ENTER: "ENTER"
}
/res/2.0/scripts/animation/animate.js
/** =======================================================================
* Vincent Hardy
* License terms: see svg-wow.org
* CC0 http://creativecommons.org/publicdomain/zero/1.0/
* ======================================================================= */
(function () {
sw.animation = sw.animation || {};
yui = YAHOO;
var Anim = yui.util.Anim;
/**
* Object with the names of the transform pseudo attributes.
*/
var PSEUDO_ATTRIBUTES = {
tx: "#tx",
ty: "#ty",
sx: "#sx",
sy: "#sy",
r: "#r"
};
var PSEUDO_DEFAULTS = {
tx: 0,
ty: 0,
sx: 1,
sy: 1,
r: 0
};
var PSEUDO_ATTRIBUTES_ARRAY = ["tx", "ty", "sx", "sy", "r"];
var N_PSEUDO_ATTRIBUTES = PSEUDO_ATTRIBUTES_ARRAY.length;
/**
* Simple extension of the YUI animation classes to handle SVG transforms.
*
* The extension handles the "r", "sx", "sy", "tx" and "ty" pseudo attributes
* by manipulating the transform of the target element using a template.
*
* @param p_el the element that will be animated
* @param p_attributes the attributes to animate. This animation class adds the
* "r" (rotation), "tx", "ty", "sx" and "sy" (scale) pseudo-attributes.
* @param p_oTransformTemplate the template for the transform attribute to
* animate. By default, it is
* "translate(#tx,#ty) scale(#sx,#sy) rotate(#r)"
* but it can be set to any string.
* @param p_oDuration the animation duration
* @param p_oMethod easing method
*
* @see http://developer.yahoo.com/yui/docs/YAHOO.util.Anim.html
*/
sw.animation.Animate = function (p_el, p_attributes,
p_oDuration,
p_oMethod) {
sw.animation.Animate.superclass.constructor.call(this, p_el,
p_attributes, p_oDuration, p_oMethod);
var el = sw.stringToElement(p_el);
var _endCallbacks = [];
var _endAnimations = [];
var _beginCallbacks = [];
var _beginAnimations = [];
this._endCallbacks = _endCallbacks;
this._endAnimations = _endAnimations;
this._beginCallbacks = _beginCallbacks;
this._beginAnimations = _beginAnimations;
this.onComplete.subscribe(function () {
for (var i = 0; i < _endCallbacks.length; i++) {
_endCallbacks[i]();
}
for (i = 0; i < _endAnimations.length; i++) {
_endAnimations[i].animate();
}
});
this.onStart.subscribe(function () {
for (var i = 0; i < _beginCallbacks.length; i++) {
_beginCallbacks[i]();
}
for (i = 0; i < _beginAnimations.length; i++) {
_beginAnimations[i].animate();
}
});
};
yui.lang.extend(sw.animation.Animate,
Anim, {
/**
* Sets the new attribute value
*
* @param p_attr the attribute name
* @param p_val the attribute value
* @param p_unit the unit
*/
setAttribute : function (p_attr, p_val, p_unit) {
var el = this.getEl();
if (attributeHandlers[p_attr] &&
attributeHandlers[p_attr].setAttribute) {
return attributeHandlers[p_attr].setAttribute.call(this, el, p_val);
} else {
// Let the base class handle the attributes
sw.animation.Animate.superclass.setAttribute.call(this,
p_attr, p_val, p_unit);
}
},
/**
* Gets the attribute value
*
* @param p_attr the attribute name
*/
getAttribute : function (p_attr) {
if (attributeHandlers[p_attr] &&
attributeHandlers[p_attr].getAttribute) {
return attributeHandlers[p_attr].getAttribute.call(this, this.getEl());
} else {
// Let the base class handle the attribute
return sw.animation.Animate.superclass.
getAttribute.call(this, p_attr);
}
},
/**
* Overrides the default implementation to check if there is an attribute
* handler for the attribute.
* @param {String} attr The name of the attribute.
* @param {Number} start The value this attribute should start from for this animation.
* @param {Number} end The value this attribute should end at for this animation.
* @return The Value to be applied to the attribute.
*/
doMethod : function (attr, start, end) {
var val;
if (attributeHandlers[attr] &&
attributeHandlers[attr].interpolate) {
var p = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
val = attributeHandlers[attr].interpolate.call(this, start, end, p);
} else {
val = Anim.prototype.doMethod.call(this, attr, start, end);
}
return val;
},
/**
* Implementation helper: applies the current transform.
* Note that this quite costly, from a computation perspective, so
* it should be use conservatively.
*/
applyTransform : function () {
var txf = this.transformTemplate;
var el = this.getEl();
var attrs = PSEUDO_ATTRIBUTES;
var a = PSEUDO_ATTRIBUTES_ARRAY;
var n = a.length;
var p;
for (var i = 0; i < n; i++) {
p = a[i];
txf = txf.replace(attrs[p], el[p]);
}
el.setAttribute("transform", txf);
},
/**
* Returns a handler that will start this animation instance when invoked.
*/
getStartHandler : function () {
var that = this;
if (this._startHandler === undefined) {
this._startHandler = function () {
that.animate();
};
}
return this._startHandler;
},
/**
* Adds a function of animation to call or play when this animation ends
*
* @param p_animOrCallback an animation or function to trigger when this
* animation ends
*/
onEnd : function (p_animOrCallback) {
if (typeof p_animOrCallback === "function") {
this._endCallbacks.push(p_animOrCallback);
} else if (p_animOrCallback !== null &&
p_animOrCallback !== undefined &&
typeof p_animOrCallback.animate === "function") {
this._endAnimations.push(p_animOrCallback);
}
},
/**
* Adds a function of animation to call or play when this animation begins
*
* @param p_animOrCallback an animation or function to trigger when this
* animation begins
*/
onBegin : function (p_animOrCallback) {
if (typeof p_animOrCallback === "function") {
this._beginCallbacks.push(p_animOrCallback);
} else if (p_animOrCallback !== null &&
p_animOrCallback !== undefined &&
typeof p_animOrCallback.animate === "function") {
this._beginAnimations.push(p_animOrCallback);
}
}
});
/**
* Class static
*/
var attributeHandlers = {};
/**
* Adds a new way to handle a given attribute. The handler should have the
* following:
*
* - setAttribute. A funtion taking the element and value as parameters.
* - getAttribute. A function taking the element as parameter and
* returning the attribute value.
* - interpolate. A function taking the start value, end value, current
* progress in time interval and interpolation method as a parameter. It
* should return the value to apply to the animation target.
*
* @param p_attributeName the name of the attribute to which the handler
* applies.
* @param p_attributeHandler an object holding the setAttribute, getAttribute
* and interpolate methods
*/
sw.animation.Animate.addAttributeHandler = function (p_attributeName,
p_attributeHandler) {
attributeHandlers[p_attributeName] = p_attributeHandler;
};
// =============================================================================
// Generic handler for the SVG transform attribute
// =============================================================================
sw.animation.Animate.addAttributeHandler("txf", {
setAttribute: function (e, v) {
var txf = this.attributes.txf.template, val, p;
if (txf) {
for (var p in v) {
if (v.hasOwnProperty(p)) {
val = v[p];
txf = txf.replace(PSEUDO_ATTRIBUTES[p], val);
e[p] = val;
}
}
e.setAttribute("transform", txf);
}
},
getAttribute: function (e) {
var result = {
tx: 0,
ty: 0,
sx: 1,
sy: 1,
r: 0
};
for (var i = 0; i < N_PSEUDO_ATTRIBUTES; i++) {
a = PSEUDO_ATTRIBUTES_ARRAY[i];
if (e[a] !== undefined) {
result[a] = e[a];
} else {
e[a] = result[a];
}
}
return result;
},
interpolate: function (start, end, p) {
var s, e, a, result = {}, elt;
for (var i = 0; i < N_PSEUDO_ATTRIBUTES; i++) {
a = PSEUDO_ATTRIBUTES_ARRAY[i];
s = start[a];
e = end[a];
if (s === undefined) {
elt = this.getEl();
if (elt[a] !== undefined) {
s = elt[a];
}
if (s === undefined) {
s = PSEUDO_DEFAULTS[a];
}
start[a] = s;
}
if (e !== undefined) {
result[a] = p * e + (1 - p) * s;
} else {
result[a] = s;
}
}
return result;
}
});
})();