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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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 class="container">

  <!-- DRAWS IN  -->
  <svg xmlns="http://www.w3.org/2000/svg" width="170" height="170" viewBox="0 0 170 170" class="svg inlined-svg" id="svg-1">
    <path fill="#FFF" d="M85 170c-46.87 0-85-38.13-85-85S38.13 0 85 0s85 38.13 85 85-38.13 85-85 85z" id="Circle"/>
    <g id="Icons" fill="none" stroke="#282D33" stroke-width="4">
      <path d="M32.43 126.4h98M87.09 121.73v-4.61c0-1.27 1.03-2.31 2.31-2.31h33.45c1.27 0 2.31 1.03 2.31 2.31v4.61"/>
      <path d="M122.45 109.05c0-1.27-1.03-2.31-2.31-2.31H92.08c-1.27 0-2.31 1.03-2.31 2.31v3.46c0 1.27 1.03 2.31 2.31 2.31h28.06c1.27 0 2.31-1.03 2.31-2.31v-3.46zM122.11 64.67c.79.79.79 2.08 0 2.87l-18.88 18.88c-.79.79-2.08.79-2.87 0l-4.54-4.54c-.79-.79-.79-2.08 0-2.87l18.88-18.88c.79-.79 2.08-.79 2.87 0l4.54 4.54zM97.49 40.06c.79.79.79 2.08 0 2.87L78.61 61.8c-.79.79-2.08.79-2.87 0l-4.54-4.54c-.79-.79-.79-2.08 0-2.87l18.88-18.88c.79-.79 2.08-.79 2.87 0l4.54 4.55zM98.02 77.55L80.07 59.61M113.24 62.33L95.3 44.39"/>
      <path d="M91.9 71.436l-38.6 38.6-5.706-5.706 38.6-38.6z" stroke-width="3.99996"/>
      <path d="M40.233 108.857l5.947-5.947 8.534 8.535-5.946 5.946z" stroke-width="3.99996"/>
      <path d="M83.88 79.18l-5.44-5.44M78.17 84.89l-5.44-5.44M100.11 65.05l-7.54-7.54M122.07 90.9h8.75M120.75 84.37l7.38-4.69M120.75 97.43l7.38 4.69M91.5 90.9h-8.75M92.82 97.43l-7.38 4.69"/>
    </g>
  </svg>
  
  <!--  DRAWS IN  -->
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="170px" height="170px" viewBox="0 0 170 170" enable-background="new 0 0 170 170" xml:space="preserve" id="svg-3">
    <g id="Background"/>
    <g id="Circle">
      <g>
        <path fill="#FFFFFF" d="M85 170c-46.869 0-85-38.131-85-85S38.131 0 85 0s85 38.131 85 85S131.869 170 85 170z"/>
      </g>
    </g>
    <g id="TEXT"/>
    <g id="Icons">
      <g>
        <g>
          <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="107.982" y1="43.642" x2="57.866" y2="43.642"/>
          <polyline fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" points="49.524 43.642 36.413 43.642 36.413 63.794 129.666 63.794 129.666 43.642 115.556 43.642 "/>
          <g>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="54.396" y1="75.784" x2="49.131" y2="75.784"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="64.822" y1="75.784" x2="59.556" y2="75.784"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="75.247" y1="75.784" x2="69.981" y2="75.784"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="85.673" y1="75.784" x2="80.407" y2="75.784"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="96.099" y1="75.784" x2="90.831" y2="75.784"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="106.525" y1="75.784" x2="101.256" y2="75.784"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="116.948" y1="75.784" x2="111.682" y2="75.784"/>
          </g>
          <g>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="54.396" y1="85.7" x2="49.131" y2="85.7"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="64.822" y1="85.7" x2="59.556" y2="85.7"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="75.247" y1="85.7" x2="69.981" y2="85.7"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="85.673" y1="85.7" x2="80.407" y2="85.7"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="96.099" y1="85.7" x2="90.831" y2="85.7"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="106.525" y1="85.7" x2="101.256" y2="85.7"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="116.948" y1="85.7" x2="111.682" y2="85.7"/>
          </g>
          <g>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="54.396" y1="95.615" x2="49.131" y2="95.615"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="64.822" y1="95.615" x2="59.556" y2="95.615"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="75.247" y1="95.615" x2="69.981" y2="95.615"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="85.673" y1="95.615" x2="80.407" y2="95.615"/>
          </g>
          <g>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="54.396" y1="105.53" x2="49.131" y2="105.53"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="64.822" y1="105.53" x2="59.556" y2="105.53"/>
            <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="75.247" y1="105.53" x2="69.981" y2="105.53"/>
          </g>
          <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="127.766" y1="91.841" x2="127.766" y2="63.908"/>
          <polyline fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" points="38.313 63.908 38.313 120.98 80.301 120.98 "/>
          <g>
            <polyline fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" points="108.453 53.278 116.292 53.278 116.292 35.701 108.453 35.701 "/>
            <polyline fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" points="49.786 53.278 57.624 53.278 57.624 35.701 49.786 35.701 "/>
          </g>
          <line fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" x1="71.789" y1="53.222" x2="94.289" y2="53.222"/>
        </g>
        <circle fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" cx="107.135" cy="113.007" r="20.833"/>
        <polyline fill="none" stroke="#282D33" stroke-width="4" stroke-miterlimit="10" points="96.969 113.174 102.469 118.674 117.136 104.007 "/>
      </g>
    </g>
  </svg>
  
  <!--  DOESN'T DRAW IN  -->
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="-314 316 170 170" style="enable-background:new -314 316 170 170;" xml:space="preserve">
<style type="text/css">
	.st0{fill:none;stroke:#282D33;stroke-width:4;}
	.st1{fill:none;stroke:#282D33;stroke-width:4;stroke-linecap:square;}
</style>
<g id="Background">
</g>
<g id="TEXT">
</g>
<g id="Icons">
	<g>
		<path class="st0" d="M-207.1,408.8h5.8h14.3c0,0,0,0,0,0c0.2,0,0.5,0,0.7,0c4.5,0,8.1-3.6,8.1-8.1c0-4.4-3.5-8-7.9-8.1
			c0.1-0.7,0.1-1.4,0.1-2.1c0-9.8-7.9-17.8-17.7-17.8c-1.7,0-3.3,0.2-4.8,0.7c-1.7-12.7-12.6-22.5-25.8-22.5c-14.4,0-26,11.7-26,26
			c0,0.1,0,0.1,0,0.2c-7.9,0.9-14.1,7.6-14.1,15.8c0,8.8,7.1,15.9,15.9,15.9h5.1"/>
		<path class="st0" d="M-253.3,378.1l0-0.2c0-11,9-20,20.1-20"/>
		<path class="st0" d="M-267.3,393.9c0-5,3.8-9.3,8.8-9.8"/>
		<g>
			<path class="st0" d="M-204.7,452v-24.2c5.7-5.7,9.3-13.6,9.3-22.4c0-17.5-14.2-31.7-31.7-31.7c-17.5,0-31.7,14.2-31.7,31.7
				c0,0.5,0,1,0,1.4l-4.4,7.7l-5.8,10.1h7.4v12.5c0,4.7,3.8,8.5,8.5,8.5h13.5v6.4"/>
		</g>
		<polygon class="st1" points="-209.3,396.6 -227.3,396.6 -220.6,376.3 -246.8,408.8 -228.8,408.8 -235.5,429.1 		"/>
	</g>
</g>
</svg>

  
  <!--  DOESN'T DRAW IN  -->
  <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="170px" height="170px" viewBox="0 0 170 170" id="svg-2">
    <path fill="#FFF" d="M85,170c-46.869,0-85-38.131-85-85S38.131,0,85,0s85,38.131,85,85S131.869,170,85,170z" id="Circle"/>
    <g id="Icons">
      <path fill="#282D33" d="M83.306,135.676c-27.938,0-50.666-22.729-50.666-50.668h4c0,25.733,20.935,46.668,46.666,46.668 s46.666-20.935,46.666-46.668c0-25.732-20.935-46.666-46.666-46.666v-4c27.938,0,50.666,22.729,50.666,50.666 C133.972,112.946,111.243,135.676,83.306,135.676z"/>
      <path fill="#282D33" d="M36.64 85.008h-4c0-.697.015-1.39.042-2.08l3.996.159C36.652 83.724 36.64 84.365 36.64 85.008zM36.969 79.442l-3.973-.471c.156-1.313.365-2.632.622-3.919l3.922.783C37.304 77.02 37.111 78.233 36.969 79.442zM38.396 72.285l-3.85-1.089c.357-1.263.771-2.532 1.229-3.773l3.752 1.386C39.105 69.952 38.725 71.122 38.396 72.285zM40.93 65.437l-3.631-1.68c.552-1.192 1.159-2.38 1.806-3.532l3.488 1.957C41.997 63.244 41.438 64.339 40.93 65.437zM44.507 59.07l-3.324-2.226c.736-1.1 1.522-2.179 2.336-3.208l3.139 2.48C45.908 57.064 45.185 58.058 44.507 59.07zM49.032 53.337l-2.938-2.715c.896-.97 1.84-1.914 2.806-2.806l2.715 2.938C50.727 51.575 49.857 52.444 49.032 53.337zM54.393 48.376l-2.482-3.138c1.033-.818 2.113-1.604 3.207-2.337l2.227 3.323C56.337 46.899 55.344 47.623 54.393 48.376zM60.455 44.309l-1.961-3.486c1.147-.646 2.336-1.254 3.53-1.808l1.682 3.629C62.606 43.153 61.513 43.713 60.455 44.309zM67.078 41.24l-1.393-3.75c1.238-.459 2.506-.874 3.771-1.232l1.09 3.849C69.384 40.436 68.217 40.817 67.078 41.24zM74.098 39.249l-.785-3.922c1.289-.258 2.607-.468 3.917-.625l.475 3.972C76.498 38.818 75.284 39.012 74.098 39.249zM81.385 38.38l-.158-3.997c.689-.027 1.383-.042 2.079-.042v4C82.662 38.342 82.021 38.355 81.385 38.38z"/>
      <g>
        <path fill="#282D33" d="M95.601,109.646L83.306,97.354l-12.295,12.293L58.667,97.305L70.962,85.01L58.667,72.717l12.344-12.347 l12.295,12.295l12.295-12.295l12.343,12.347L95.649,85.01l12.296,12.295L95.601,109.646z M83.306,91.697l12.295,12.293 l6.687-6.686L89.991,85.01l12.297-12.293l-6.688-6.688L83.306,78.323L71.011,66.028l-6.688,6.688L76.618,85.01L64.323,97.305 l6.688,6.686L83.306,91.697z"/>
      </g>
    </g>
  </svg>

</div>

<div class="button-holder">
  <button>Run</button>
</div>

              
            
!

CSS

              
                .container {
  width: 800px;
  height: 600px;
}
svg {
  visibility: hidden;
}

html {
  background: #000;
}

.button-holder { 
  width: 100%;
  position: fixed; 
  bottom: 10px; 
  text-align: center; }
button {
  cursor: pointer;
  border: none;
  padding: 7px 10px;
  font-size: 14px;
  background: blue;
  display: inline-block;
  margin-right: 10px;
  color: white;
  font-weight: bold;
}
button:hover {
  background: lightblue;
  color: #222222;
}

              
            
!

JS

              
                var main = new TimelineMax();
var shapesArr = ["rect", "circle", "ellipse", "polyline", "polygon", "path", "line"];

function animateLines(shapes) {
  // return TweenMax.staggerFrom(shapes, 0.5, {drawSVG:"100% 100%",ease: Power1.easeOut},0.5);
  return TweenMax.fromTo(shapes, 1, {drawSVG:0}, {drawSVG:"102%"}, "-=1"); // draw the lines
}

function hideSVG() {
  return TweenMax.set('svg', {visibility:"hidden"});
}

function unHideSVG(svg) {
  return TweenMax.set(svg, {visibility:"visible"});
}

function hideStrokes(shapes) {
  console.log(shapes);
  return TweenMax.set(shapes, {drawSVG:0});
}

function getShapes(svg) {
  var shapes = [];
  // now parse through the SVG to see what types of shapes are present and create an array of elements
  for ( var s=0; s<shapesArr.length; s++ ) {
    var shape = shapesArr[s];
    if ( svg.find(shape).length > 0 ) {
      shapes.push('#'+svg.attr('id') + " " + shape);
    }
  }
  return shapes;
}

function draw(svg)
{
  var shapes = getShapes(svg);
  main.add(unHideSVG(svg)) // un-hide the svg
      .add(hideStrokes(shapes)) //hide the strokes
      .add(animateLines(shapes));
}

$('button').click(function(){
  // main.clear();
  // main.add(hideSVG());
  $('svg').each(function(){
    draw($(this));
  });
});


              
            
!
999px

Console