Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!-- Bird from https://www.freepik.com/ -->
<svg viewBox="0 0 500 500">
  <rect x="0" y="0" width="20" height="20" />
  <rect x="480" y="0" width="20" height="20" />
  <rect x="0" y="480" width="20" height="20" />
  <rect x="480" y="480" width="20" height="20" />
  <rect x="240" y="240" width="20" height="20" />
  <path class="a" d="M213.07,369.87c2.7,2.38,5.19,4.91,7.63,7.47s4.78,5.21,7.07,7.88,4.51,5.4,6.68,8.16,4.28,5.57,6.36,8.39l-4.26-1.24c1.9-.71,3.63-1.23,5.47-1.75s3.66-.9,5.52-1.22a50.11,50.11,0,0,1,11.37-.79,28.61,28.61,0,0,1,11.31,2.7,15.18,15.18,0,0,1,7.74,8.22,17.63,17.63,0,0,0-4.24-3.18,18.66,18.66,0,0,0-4.73-1.67,32.31,32.31,0,0,0-10-.34A68.78,68.78,0,0,0,249,404.32c-1.66.41-3.33.86-5,1.37s-3.33,1.05-4.8,1.61l-2.63,1-1.63-2.25c-2.05-2.84-4.08-5.71-6-8.62s-3.87-5.87-5.72-8.86-3.63-6-5.33-9.14S214.51,373.17,213.07,369.87Z"/>
  <path class="a" d="M236.72,408.42a10.85,10.85,0,0,0-1.32-.34c-.48-.1-1-.2-1.47-.27a29.88,29.88,0,0,0-3-.31,20.83,20.83,0,0,0-6,.52,12.14,12.14,0,0,0-5.3,2.71,12.51,12.51,0,0,0-3.39,5.36,13.26,13.26,0,0,1,2-6.51,14.86,14.86,0,0,1,5.29-4.91,24.94,24.94,0,0,1,6.8-2.59,33.08,33.08,0,0,1,3.58-.63c.6-.08,1.21-.14,1.82-.18s1.18-.08,2-.06Z"/>
  <path class="b" d="M236.9,372.45c2.7,2.38,5.19,4.91,7.63,7.47s4.78,5.2,7.07,7.88,4.51,5.4,6.68,8.16,4.28,5.56,6.36,8.39l-4.26-1.25c1.91-.71,3.64-1.23,5.47-1.74s3.66-.9,5.52-1.23a51.32,51.32,0,0,1,11.37-.79,28.79,28.79,0,0,1,11.31,2.71,15.15,15.15,0,0,1,7.74,8.22,17.43,17.43,0,0,0-4.24-3.18,18.15,18.15,0,0,0-4.73-1.67,32.61,32.61,0,0,0-10-.35,71.55,71.55,0,0,0-10.06,1.82c-1.66.42-3.33.86-5,1.38s-3.33,1.05-4.8,1.6l-2.63,1-1.63-2.25c-2.05-2.85-4.08-5.71-6-8.63s-3.87-5.86-5.72-8.86-3.63-6-5.33-9.14S238.34,375.75,236.9,372.45Z"/>
  <path class="b" d="M260.55,411a13.08,13.08,0,0,0-1.32-.34c-.48-.1-1-.19-1.47-.26a27.29,27.29,0,0,0-3-.31,20.51,20.51,0,0,0-6,.52,12.25,12.25,0,0,0-5.3,2.71,12.54,12.54,0,0,0-3.39,5.35,13.54,13.54,0,0,1,2-6.51,15,15,0,0,1,5.29-4.91,25.24,25.24,0,0,1,6.8-2.58,33.11,33.11,0,0,1,3.58-.64c.6-.07,1.21-.13,1.82-.17s1.19-.08,2-.06Z"/>
  <path class="c" d="M367.21,126.57S486.26,178.39,485.7,181.2s-128.59-17.57-128.59-17.57Z"/>
  <path class="d" d="M375.64,148.47s-5.9-57.28-86.76-66.55a176.24,176.24,0,0,0-31.59-.4c-9.82.7-23.31,1.14-28.64,4.21-3.41,2,2.74,6-.42,8.85s-10.58-.33-12.63,2.52c-1.63,2.27,2.79,8.62.84,10.53s-9.87,4.85-9.69,7.58c.17,2.53,7.71,8,7,10.31-4.55,15.38-4.77,30.63-5.74,38.11-2.53,19.37-51.39,33.69-87.6,74.12S27.76,389.37,20.18,404.53s70.75,1.69,110.34-12.63,48,23.58,109.5-8.43S361.42,259.41,341.1,206.59C328.47,173.74,373.11,161.94,375.64,148.47Z"/>
  <path class="e" d="M340.9,133.32a15.17,15.17,0,1,1-15.16-15.16A15.16,15.16,0,0,1,340.9,133.32Z"/>
  <path class="f" d="M337.25,133.32a11.52,11.52,0,1,1-11.51-11.51A11.52,11.52,0,0,1,337.25,133.32Z"/>
  <path class="g" d="M293.2,133.88c-10.5.23-28.42,8.73-25.15,21.88,4.74,19.08,22.26,16.14,39.67,11.51,7.83-2.07,25.77-1.17,32-6.35,9.08-7.58-5-9.65-15.69-9.73C311,151.09,306.4,133.59,293.2,133.88Z"/>
  <path class="h" d="M307.06,234.39c-7.58,49.27-99.81,117.5-123.81,126.34-13.9,5.12-26.95,16.61-36.22,27.82,27-.88,41.06,22,93-5.08,61.49-32,121.4-124.06,101.08-176.88a30.17,30.17,0,0,1-2.16-13.24C329.69,193.59,312.51,199,307.06,234.39Z"/>
  <path class="i" d="M343.81,216.07c3.83,53.66-49.9,130.35-104.91,159-46.32,24.12-62.53,8.55-84.63,5.53-2.6,2.61-5,5.3-7.24,8,27-.88,41.06,22,93-5.08C298,353.3,354.52,269.79,343.81,216.07Z"/>
  <path class="j" d="M299.48,207.86c-4-26.8-71.88-30.21-100.81-30.44-16.38,14.17-50.91,29.81-78.25,60.33C84.2,278.18,27.76,389.37,20.18,404.53c-5.34,10.67,31.88,7.16,68.19-.85C198.3,355.31,303.5,235,299.48,207.86Z"/>
  <path class="k" d="M336.33,240.72a25.81,25.81,0,0,1,.76,7,32.24,32.24,0,0,1-.9,7,23.67,23.67,0,0,1-2.63,6.69,12.61,12.61,0,0,1-5.09,5.07,29.11,29.11,0,0,0,2.84-6.13c.73-2.07,1.27-4.22,1.8-6.38s1-4.35,1.51-6.57S335.64,243,336.33,240.72Z"/>
  <path class="k" d="M320.33,247.74a16.41,16.41,0,0,1,.45,5.34,21,21,0,0,1-1,5.24,16.73,16.73,0,0,1-2.43,4.85,9.13,9.13,0,0,1-4.31,3.38,31.65,31.65,0,0,0,2.13-4.59c.6-1.51,1.08-3.07,1.6-4.62s1-3.15,1.58-4.75A42.42,42.42,0,0,1,320.33,247.74Z"/>
  <path class="k" d="M322,270.76a16.39,16.39,0,0,1-.38,5.25,23.67,23.67,0,0,1-1.7,4.92,21,21,0,0,1-2.81,4.43,13.5,13.5,0,0,1-4.09,3.37c.63-1.7,1.32-3.2,2-4.71s1.35-3,2.05-4.45,1.44-2.95,2.23-4.42A37.78,37.78,0,0,1,322,270.76Z"/>
  <path class="k" d="M302.36,284.24a13.52,13.52,0,0,1-1.05,4.38,19.3,19.3,0,0,1-2.12,3.86,18.56,18.56,0,0,1-3,3.29,11.2,11.2,0,0,1-4,2.23,36.52,36.52,0,0,1,2.07-3.86c.72-1.21,1.48-2.36,2.29-3.49s1.65-2.24,2.58-3.32A23.28,23.28,0,0,1,302.36,284.24Z"/>
  <path class="k" d="M307.69,300.52a17.72,17.72,0,0,1-1.75,4.78,26.19,26.19,0,0,1-2.73,4.19,21.79,21.79,0,0,1-3.55,3.57,11,11,0,0,1-4.6,2.34l2.8-4.06c.93-1.3,1.88-2.58,2.88-3.83s2.05-2.47,3.18-3.65A27.15,27.15,0,0,1,307.69,300.52Z"/>
  <path class="k" d="M286.91,311.75a16.87,16.87,0,0,1-1.17,4.61,25.81,25.81,0,0,1-2.07,4.14,22,22,0,0,1-2.84,3.71,13.8,13.8,0,0,1-1.8,1.6,5.74,5.74,0,0,1-2.22,1.11,20.15,20.15,0,0,0,1-2.1c.32-.68.63-1.38,1-2.05.67-1.34,1.38-2.66,2.18-3.94a38.92,38.92,0,0,1,2.62-3.71A22,22,0,0,1,286.91,311.75Z"/>
  <path class="l" d="M236.94,86.86a12.78,12.78,0,0,1,3.9-1,19.16,19.16,0,0,1,3.86,0,18.73,18.73,0,0,1,3.82.76,9.39,9.39,0,0,1,3.58,2,26.84,26.84,0,0,1-3.91.5,25.07,25.07,0,0,1-3.78-.07,24.5,24.5,0,0,1-3.75-.64A15,15,0,0,1,236.94,86.86Z"/>
  <path class="l" d="M226.83,99.21a9.9,9.9,0,0,1,3.15-1.1,13.3,13.3,0,0,1,3.08-.2,13.45,13.45,0,0,1,3.05.48,10.26,10.26,0,0,1,3.07,1.38,9.18,9.18,0,0,1-3.11,1.11,14.14,14.14,0,0,1-3.11.19,13.7,13.7,0,0,1-3.1-.48A9.65,9.65,0,0,1,226.83,99.21Z"/>
  <path class="l" d="M247,94.72a8.86,8.86,0,0,1,3-.81,11.77,11.77,0,0,1,5.59.84,8.69,8.69,0,0,1,2.64,1.65,8.29,8.29,0,0,1-3,.82,12.18,12.18,0,0,1-5.64-.85A8.56,8.56,0,0,1,247,94.72Z"/>
  <path class="l" d="M216.72,113.81a8,8,0,0,1,2.89-1.77,11.09,11.09,0,0,1,3.16-.68,10.69,10.69,0,0,1,3.27.28,6.68,6.68,0,0,1,3,1.61,19.48,19.48,0,0,1-3.13.88,21.43,21.43,0,0,1-3,.39,21.78,21.78,0,0,1-3,0A12.65,12.65,0,0,1,216.72,113.81Z"/>
  <path class="l" d="M231.88,107.07a14.12,14.12,0,0,1,3.79-1.24,21.19,21.19,0,0,1,3.79-.34,19.36,19.36,0,0,1,3.79.34,13.24,13.24,0,0,1,3.79,1.24,13.59,13.59,0,0,1-3.79,1.25,21,21,0,0,1-7.58,0A13.45,13.45,0,0,1,231.88,107.07Z"/>
  <path class="l" d="M261.64,86.86a10.86,10.86,0,0,1,3.4-1.67,15.6,15.6,0,0,1,3.58-.61,13.52,13.52,0,0,1,3.68.32,8.37,8.37,0,0,1,1.83.66,3.91,3.91,0,0,1,1.55,1.3,10.58,10.58,0,0,0-1.81.24c-.57.1-1.14.21-1.7.29a29.45,29.45,0,0,1-3.4.36,25.42,25.42,0,0,1-3.48-.08A14.32,14.32,0,0,1,261.64,86.86Z"/>
  <path class="l" d="M255.47,104.83a18,18,0,0,1,4.62-1.36,28.21,28.21,0,0,1,4.68-.36,24.05,24.05,0,0,1,4.69.46,10.93,10.93,0,0,1,4.54,1.82c-1.64.24-3.12.52-4.67.67a43.81,43.81,0,0,1-4.59.22,35.86,35.86,0,0,1-4.61-.33A21.18,21.18,0,0,1,255.47,104.83Z"/>
  <path class="l" d="M268.94,95.28a13.4,13.4,0,0,1,4-1.52,18.78,18.78,0,0,1,4.16-.43,17.21,17.21,0,0,1,4.2.53,8.94,8.94,0,0,1,3.9,2c-1.49.21-2.8.39-4.14.5s-2.65.17-4,.16a34.18,34.18,0,0,1-4-.26A19.08,19.08,0,0,1,268.94,95.28Z"/>
  <path class="l" d="M285.79,88.54a9.55,9.55,0,0,1,3.42-1.45,12.72,12.72,0,0,1,3.59-.27,10.47,10.47,0,0,1,3.6.83,5.23,5.23,0,0,1,2.87,2.57,24.41,24.41,0,0,0-3.44-.14c-1.07,0-2.14,0-3.24-.1a27.85,27.85,0,0,1-3.32-.41A15,15,0,0,1,285.79,88.54Z"/>
  <path class="m" d="M194.54,192.71a75.06,75.06,0,0,0-5.37,7.35,36.61,36.61,0,0,0-4,7.94,12.57,12.57,0,0,0-.7,4.06,5.09,5.09,0,0,0,1.15,3.29,5.6,5.6,0,0,0,1.31,1.14c.25.16.52.24.76.38s.55.16.82.25a9.64,9.64,0,0,0,3.78,0,20.35,20.35,0,0,0,4-1.17,40.48,40.48,0,0,0,4-1.75,75.49,75.49,0,0,0,7.62-4.48,151.46,151.46,0,0,0,14.24-10.77l6.35-5.48-1.64,8.35a73.43,73.43,0,0,0-1.11,9,47.12,47.12,0,0,0,.19,8.91,18.75,18.75,0,0,0,2.37,7.69,7.36,7.36,0,0,0,5.44,3.64,9.67,9.67,0,0,0,3.55-.12,14.94,14.94,0,0,0,3.59-1.41,28.41,28.41,0,0,0,6.62-5.35,56.29,56.29,0,0,0,5.64-7,73.09,73.09,0,0,0,4.68-7.82l3.84-7.51,1.22,8.21a107.14,107.14,0,0,0,3,14.08,42.35,42.35,0,0,0,2.42,6.55,11.32,11.32,0,0,0,1.7,2.58,2.75,2.75,0,0,0,.86.64c.12.09.23.06.34.12s.2,0,.34-.05a2.68,2.68,0,0,0,1-.56c.17-.18.35-.33.53-.52l.53-.6a19.39,19.39,0,0,0,1.87-2.89,54.57,54.57,0,0,0,3-6.59c1.77-4.55,3.22-9.26,4.57-14a108,108,0,0,1-2.7,14.62,53.76,53.76,0,0,1-2.38,7.17,22.93,22.93,0,0,1-1.81,3.51,7.55,7.55,0,0,1-3.45,3.09,4.57,4.57,0,0,1-1.46.3,5,5,0,0,1-1.46-.22,6.38,6.38,0,0,1-2.25-1.3,14.77,14.77,0,0,1-2.66-3.35,39,39,0,0,1-3.22-7.09,111.89,111.89,0,0,1-4-14.61l5.06.7a77.1,77.1,0,0,1-4.78,8.67,62.18,62.18,0,0,1-6,8,36.64,36.64,0,0,1-3.66,3.6,26.88,26.88,0,0,1-4.34,3.08A20,20,0,0,1,238.7,237a16,16,0,0,1-5.9.24,13.77,13.77,0,0,1-5.7-2.13,14.23,14.23,0,0,1-4.16-4.39,24.77,24.77,0,0,1-3.24-10.31,53.93,53.93,0,0,1,0-10.08,68.61,68.61,0,0,1,1.54-9.84l4.71,2.87c-2.47,2-4.93,3.81-7.48,5.6s-5.14,3.48-7.84,5.05a78.73,78.73,0,0,1-8.38,4.31,32,32,0,0,1-9.36,2.68,13.16,13.16,0,0,1-5.28-.43,10.56,10.56,0,0,1-1.31-.53,13.4,13.4,0,0,1-1.23-.75,8.92,8.92,0,0,1-2-2,8.06,8.06,0,0,1-1.34-5.3,15.34,15.34,0,0,1,1.32-4.81,34.8,34.8,0,0,1,5.1-7.86A57.79,57.79,0,0,1,194.54,192.71Z"/>
  <path class="m" d="M151.58,227.24a73.92,73.92,0,0,0-6,4.69,51.65,51.65,0,0,0-5.39,5.27,18,18,0,0,0-3.73,6.09,5.22,5.22,0,0,0-.09,3,4.8,4.8,0,0,0,1.73,2.33,8.14,8.14,0,0,0,6.06,1.2,26,26,0,0,0,6.79-2,68.54,68.54,0,0,0,12.7-7.39l7.33-5.37-3.74,8.43a42.16,42.16,0,0,0-2.45,7.34,25.68,25.68,0,0,0-.76,7.39,9.27,9.27,0,0,0,2.22,5.82,7.6,7.6,0,0,0,2.46,1.74,7,7,0,0,0,2.77.62,12.55,12.55,0,0,0,6.19-2,33.55,33.55,0,0,0,5.94-4.68,74.09,74.09,0,0,0,10-12.23l6.46-9.72-.63,11.62a72,72,0,0,0,.69,15.62,21.66,21.66,0,0,0,2.15,6.79,5.62,5.62,0,0,0,1.68,2,2.62,2.62,0,0,0,1.93.39,9.25,9.25,0,0,0,2.89-1,20.88,20.88,0,0,0,3.06-2,53,53,0,0,0,5.81-5.19A119.88,119.88,0,0,0,228,253.71l3.35-4.51.88,5.43c.37,2.23.85,4.55,1.4,6.79s1.16,4.49,1.91,6.65a25.49,25.49,0,0,0,2.86,6,6.38,6.38,0,0,0,2,2,2.44,2.44,0,0,0,2.17.08,8.55,8.55,0,0,0,2.52-1.73,24.81,24.81,0,0,0,2.27-2.5,60.09,60.09,0,0,0,3.92-5.8c1.21-2,2.32-4.12,3.4-6.24s2.12-4.25,3.07-6.44a98,98,0,0,1-5,13.43,47.85,47.85,0,0,1-3.5,6.38,25.43,25.43,0,0,1-2.28,3,11.21,11.21,0,0,1-3.16,2.53,5.92,5.92,0,0,1-2.28.62,5.45,5.45,0,0,1-2.45-.44,9.51,9.51,0,0,1-3.32-2.75,28.23,28.23,0,0,1-3.76-6.63,76.84,76.84,0,0,1-4.31-14l4.24.92a113.86,113.86,0,0,1-10.34,13.27,57.86,57.86,0,0,1-6.26,5.92,27.35,27.35,0,0,1-3.76,2.58,14.66,14.66,0,0,1-4.77,1.79,7.73,7.73,0,0,1-1.47.13h-.76l-.8-.12a8.35,8.35,0,0,1-2.94-1.1,11,11,0,0,1-3.8-4,27.69,27.69,0,0,1-2.95-8.75,65,65,0,0,1-.93-8.58c-.13-2.86-.15-5.63,0-8.56l5.82,1.9a74.56,74.56,0,0,1-5.13,7,70.3,70.3,0,0,1-5.88,6.36,39.68,39.68,0,0,1-7.11,5.47,20.81,20.81,0,0,1-4.35,2,14.22,14.22,0,0,1-5.09.77,13,13,0,0,1-5.21-1.32A13.47,13.47,0,0,1,162,267.9a13.33,13.33,0,0,1-2.59-4.54,17,17,0,0,1-.86-4.84,28.89,28.89,0,0,1,1.18-9c.4-1.42.87-2.8,1.4-4.16s1.08-2.65,1.79-4l3.6,3.06a79.12,79.12,0,0,1-6.82,4,53.38,53.38,0,0,1-7.24,3.2,29.86,29.86,0,0,1-7.95,1.78,14.48,14.48,0,0,1-4.32-.34,9.08,9.08,0,0,1-4-2.1,7.68,7.68,0,0,1-2.38-4,7.77,7.77,0,0,1,.45-4.49,18.88,18.88,0,0,1,4.76-6.48A59.14,59.14,0,0,1,151.58,227.24Z"/>
  <path class="m" d="M108.62,271q-2.49,3.15-4.67,6.5a48,48,0,0,0-3.83,6.88A20.6,20.6,0,0,0,98.87,288a7.64,7.64,0,0,0-.14,3.37,3.51,3.51,0,0,0,1.54,2.21,6,6,0,0,0,3,.86,15.48,15.48,0,0,0,6.81-1.67,44.44,44.44,0,0,0,6.6-3.77,95.33,95.33,0,0,0,12-9.86l9.07-8.64-4.6,11.75a78.85,78.85,0,0,0-4.6,16.46,22,22,0,0,0,0,7.72,5.26,5.26,0,0,0,1.18,2.49,3.46,3.46,0,0,0,2.11,1c.26,0,.47.08.76.09h.92a16.49,16.49,0,0,0,1.84-.15,17.46,17.46,0,0,0,3.67-.92,29,29,0,0,0,7-3.86,49.61,49.61,0,0,0,6.27-5.56c1-1,1.93-2.07,2.84-3.16s1.82-2.24,2.56-3.29l9.2-13.14-4,15.41a60.65,60.65,0,0,0-1.5,8,42.06,42.06,0,0,0-.29,8,13.23,13.23,0,0,0,2.08,6.79,6,6,0,0,0,2.42,1.9,7.55,7.55,0,0,0,3.33.57,14.46,14.46,0,0,0,7.11-2.47,35.78,35.78,0,0,0,6.39-5.16,82.51,82.51,0,0,0,10.54-13.24,64,64,0,0,1-3.95,7.62,58.3,58.3,0,0,1-4.93,7.12,37.85,37.85,0,0,1-6.28,6.24,17.86,17.86,0,0,1-8.58,3.71,11.8,11.8,0,0,1-5.07-.48,9.7,9.7,0,0,1-4.43-3,14.12,14.12,0,0,1-2.48-4.44,24.45,24.45,0,0,1-1.09-4.63,43,43,0,0,1-.16-9.06,65.07,65.07,0,0,1,1.36-8.86l5.16,2.28c-.92,1.42-1.81,2.62-2.78,3.86s-2,2.43-3,3.59a53.19,53.19,0,0,1-7,6.42,33.51,33.51,0,0,1-8.55,4.8,24.16,24.16,0,0,1-5,1.27,20.42,20.42,0,0,1-2.61.21l-1.32,0c-.45,0-1-.1-1.45-.16a9.86,9.86,0,0,1-5.71-2.92,11.43,11.43,0,0,1-2.71-5.43,27.2,27.2,0,0,1,.09-10,61.09,61.09,0,0,1,2.28-9.07c1-2.95,2-5.76,3.27-8.65l4.48,3.1A85.31,85.31,0,0,1,119.19,293a46.56,46.56,0,0,1-7.56,3.72,19.16,19.16,0,0,1-8.78,1.32,9.5,9.5,0,0,1-4.52-1.79,10.12,10.12,0,0,1-1-.89,6.32,6.32,0,0,1-.77-1.09,5.14,5.14,0,0,1-.52-1.21,5.68,5.68,0,0,1-.26-1.25,10.18,10.18,0,0,1,.62-4.54,23.21,23.21,0,0,1,1.78-3.84,46.14,46.14,0,0,1,4.8-6.61A65.29,65.29,0,0,1,108.62,271Z"/>
  <path class="m" d="M84.2,317.37c-1.74,2.27-3.41,4.57-5,6.93a51.77,51.77,0,0,0-4.08,7.26,21.55,21.55,0,0,0-1.29,3.71,6.88,6.88,0,0,0-.07,3.27,2.77,2.77,0,0,0,1.62,1.8,7.16,7.16,0,0,0,3.08.69,20.25,20.25,0,0,0,7.27-1.56A56.08,56.08,0,0,0,93,336a111.51,111.51,0,0,0,13.59-9.27l8-6.33-3,9.76c-.84,2.74-1.67,5.61-2.36,8.44s-1.35,5.7-1.8,8.53a33.51,33.51,0,0,0-.53,8.15,5.08,5.08,0,0,0,.71,2.41s0,.06.06.07,0,0,.06.05.1,0,.14,0a.46.46,0,0,0,.21.05l.29,0a2.36,2.36,0,0,0,.37,0,4.25,4.25,0,0,0,.82-.1,20.05,20.05,0,0,0,3.76-1.23c1.3-.54,2.59-1.21,3.87-1.88,2.58-1.37,5.12-2.91,7.63-4.51,5-3.16,10-6.64,14.93-10.07a133.22,133.22,0,0,1-13,12.64,87.92,87.92,0,0,1-7.31,5.57,46,46,0,0,1-4,2.46,22.32,22.32,0,0,1-4.65,2,10.63,10.63,0,0,1-1.39.29c-.25,0-.49.07-.75.09h-.84a3.7,3.7,0,0,1-.9-.1,5.7,5.7,0,0,1-1-.23c-.32-.13-.64-.28-1-.43a6.89,6.89,0,0,1-.84-.61,7.34,7.34,0,0,1-2-2.9,13.34,13.34,0,0,1-.76-2.78,26.53,26.53,0,0,1-.26-5.05c.06-1.62.2-3.2.39-4.76a109.3,109.3,0,0,1,4.16-18.06l5,3.42c-2.38,1.87-4.69,3.55-7.16,5.15a84.44,84.44,0,0,1-7.61,4.44,52,52,0,0,1-8.28,3.48,23.9,23.9,0,0,1-9.43,1.23,11.81,11.81,0,0,1-5-1.7,7.81,7.81,0,0,1-2.17-2,7.13,7.13,0,0,1-1.12-2.81,10.18,10.18,0,0,1,.62-5.13,21.9,21.9,0,0,1,2-4.11,47.1,47.1,0,0,1,5.41-6.89A62.37,62.37,0,0,1,84.2,317.37Z"/>
  <path class="m" d="M69,358.64a103.05,103.05,0,0,0-5.84,14.75,22.39,22.39,0,0,0-.65,3.53,7.67,7.67,0,0,0,.22,2.93,2.62,2.62,0,0,0,1.16,1.52,4.79,4.79,0,0,0,1.06.48,7.68,7.68,0,0,0,1.38.29,15.06,15.06,0,0,0,6.39-.85,46.39,46.39,0,0,0,6.82-2.93c4.58-2.33,9.07-5.17,13.89-7.93a36.21,36.21,0,0,1-4.88,6.74,42.81,42.81,0,0,1-6.18,5.68,31.78,31.78,0,0,1-7.57,4.28,17.9,17.9,0,0,1-9.45,1.19,13.45,13.45,0,0,1-2.51-.71,9.74,9.74,0,0,1-2.51-1.38,8.38,8.38,0,0,1-3.12-5.09,12.07,12.07,0,0,1,.19-5.09,21.34,21.34,0,0,1,1.49-4.23,38.18,38.18,0,0,1,4.46-7.16A44.75,44.75,0,0,1,69,358.64Z"/>
</svg>
            
          
!
            
              body {
  text-align: center;
}
svg {
  outline: 1px solid black;
  width: 1000px;
  cursor: move;
}
.a { fill: #b4343c;}
.b { fill: #ce3b45;}
.c { fill: #6d3600;}
.d { fill: #315e98;}
.e { fill: #fff;}
.f { fill: #283d54;}
.g { fill: #ffa738;}
.h { fill: #ff8e38;}
.i { fill: #dc7a30;}
.j { fill: #2072ac;}
.k { fill: #ffc26d;}
.l { fill: #2086cc;}
.m { fill: #20b1cc;}

            
          
!
            
              // We select the SVG into the page
var svg = document.querySelector('svg');

// If browser supports pointer events
if (window.PointerEvent) {
  svg.addEventListener('pointerdown', onPointerDown); // Pointer is pressed
  svg.addEventListener('pointerup', onPointerUp); // Releasing the pointer
  svg.addEventListener('pointerleave', onPointerUp); // Pointer gets out of the SVG area
  svg.addEventListener('pointermove', onPointerMove); // Pointer is moving
} else {
  
  // Add all mouse events listeners fallback
  svg.addEventListener('mousedown', onPointerDown); // Pressing the mouse
  svg.addEventListener('mouseup', onPointerUp); // Releasing the mouse
  svg.addEventListener('mouseleave', onPointerUp); // Mouse gets out of the SVG area
  svg.addEventListener('mousemove', onPointerMove); // Mouse is moving

  // Add all touch events listeners fallback
  svg.addEventListener('touchstart', onPointerDown); // Finger is touching the screen
  svg.addEventListener('touchend', onPointerUp); // Finger is no longer touching the screen
  svg.addEventListener('touchmove', onPointerMove); // Finger is moving
}

// This function returns an object with X & Y values from the pointer event
function getPointFromEvent (event) {
  var point = {x:0, y:0};
  // If even is triggered by a touch event, we get the position of the first finger
  if (event.targetTouches) {
    point.x = event.targetTouches[0].clientX;
    point.y = event.targetTouches[0].clientY;
  } else {
    point.x = event.clientX;
    point.y = event.clientY;
  }
  
  return point;
}

// This variable will be used later for move events to check if pointer is down or not
var isPointerDown = false;

// This variable will contain the original coordinates when the user start pressing the mouse or touching the screen
var pointerOrigin = {
  x: 0,
  y: 0
};

// Function called by the event listeners when user start pressing/touching
function onPointerDown(event) {
  isPointerDown = true; // We set the pointer as down
  
  // We get the pointer position on click/touchdown so we can get the value once the user starts to drag
  var pointerPosition = getPointFromEvent(event);
  pointerOrigin.x = pointerPosition.x;
  pointerOrigin.y = pointerPosition.y;
}

// We save the original values from the viewBox
var viewBox = {
  x: 0,
  y: 0,
  width: 500,
  height: 500
};

// The distances calculated from the pointer will be stored here
var newViewBox = {
  x: 0,
  y: 0
};

// Calculate the ratio based on the viewBox width and the SVG width
var ratio = viewBox.width / svg.getBoundingClientRect().width;
window.addEventListener('resize', function() {
  ratio = viewBox.width / svg.getBoundingClientRect().width;
});

// Function called by the event listeners when user start moving/dragging
function onPointerMove (event) {
  // Only run this function if the pointer is down
  if (!isPointerDown) {
    return;
  }
  // This prevent user to do a selection on the page
  event.preventDefault();

  // Get the pointer position
  var pointerPosition = getPointFromEvent(event);

  // We calculate the distance between the pointer origin and the current position
  // The viewBox x & y values must be calculated from the original values and the distances
  newViewBox.x = viewBox.x - ((pointerPosition.x - pointerOrigin.x) * ratio);
  newViewBox.y = viewBox.y - ((pointerPosition.y - pointerOrigin.y) * ratio);

  // We create a string with the new viewBox values
  // The X & Y values are equal to the current viewBox minus the calculated distances
  var viewBoxString = `${newViewBox.x} ${newViewBox.y} ${viewBox.width} ${viewBox.height}`;
  // We apply the new viewBox values onto the SVG
  svg.setAttribute('viewBox', viewBoxString);
  
  document.querySelector('.viewbox').innerHTML = viewBoxString;
}

function onPointerUp() {
  // The pointer is no longer considered as down
  isPointerDown = false;

  // We save the viewBox coordinates based on the last pointer offsets
  viewBox.x = newViewBox.x;
  viewBox.y = newViewBox.y;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console