Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="animal">
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   id="svg5777"
   version="1.1"
   viewBox="0 0 134.29048 115.32501">
  <defs
     id="defs5771" />
  <metadata
     id="metadata5774">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     transform="translate(-44.167612,-34.06796)"
     id="layer1">
    <path
       id="snail"
       transform="scale(0.26458333)"
       d="m 403.31836,130.27344 c -23.90779,0.24283 -48.15065,3.99224 -72.14648,11.67383 -116.86467,37.41091 -192.20083,164.99502 -151.66407,284.25976 32.84598,96.6374 140.15901,158.90396 239.03907,122.4375 35.65163,-13.14814 65.40078,-39.14052 83.69921,-71.08984 l -115.6875,-77.8086 c -11.25009,25.40016 -46.48632,10.74087 -58.15234,-5.52734 -26.15813,-36.47739 -1.39747,-85.256 34.75586,-103.375 57.77175,-28.95352 125.2413,7.71797 148.5957,63.98242 17.36749,41.84102 11.41925,86.18276 -9.51172,122.72852 l 126.32618,84.96484 C 672.46231,491.38633 685.16151,402.99209 660.6543,322.83789 625.93915,209.29726 518.51045,129.10342 403.31836,130.27344 Z"
       style="fill:none;fill-rule:evenodd;stroke:#ffe3b1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:100;stroke-opacity:1" />
  </g>
</svg>
</div>
              
            
!

CSS

              
                #animal
  margin: 0 auto
  width: 300px

#snail 
  stroke-dasharray: 2229px !important
  stroke-dashoffset: 2229px !important
  animation: snail 5s ease-in-out forwards
  animation-direction: alternate !important
  stroke-width: 5px !important
  
@keyframes snail {
  to {
    stroke-dashoffset: 0;
  }
}

              
            
!

JS

              
                // calculate the length of path
// https://css-tricks.com/svg-line-animation-works/
var path = document.querySelector('#snail');
var length = path.getTotalLength();
console.log(length)
              
            
!
999px

Console