cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <h1><b>Animated</b> SVG Paths <small>with Easing</small></h1>
<div class="col4">
<h2>SVG A</h2>
<svg id="svgA" width="100%" height="100%" viewBox="0 0 620 120" preserveAspectRatio="xMidYMid meet"></svg>
</div>
<div class="col4">
<h2>SVG B</h2>
<svg id="svgB" width="100%" height="100%" viewBox="0 0 620 120" preserveAspectRatio="xMidYMid meet"></svg>
</div>
<div class="col4">
<h2>SVG C</h2>
<svg id="svgC" width="100%" height="100%" viewBox="0 0 620 120" preserveAspectRatio="xMidYMid meet"></svg>
</div>
            
          
!
            
              html, body {
  height: 100%;
  padding: 25px;
  font-family: "Open Sans", cursive;
  background: #79b0a9;
  background: -webkit-linear-gradient(135deg, #79b0a9 0%, #79b096 100%);
  background: -moz-linear-gradient(135deg, #79b0a9 0%, #79b096 100%);
  background: -o-linear-gradient(135deg, #79b0a9 0%, #79b096 100%);
  background: linear-gradient(135deg, #79b0a9 0%, #79b096 100%); /* W3C */
}

html { padding: 0;}

h1, h2 {
  font-family: "Open Sans", sans-serif;
  color: #fff;
  font-size: 32px;
  font-weight: 100;
  margin-bottom: 20px;
  b {
    font-weight: 600;
  }
  small {
    font-weight: 300;
    font-size: 15px;
    color: #262a2b;}
  }

h1 { margin-top: 0;}
h2 { font-size: 18px; margin-bottom: 10px;}

.col4 {
  width: 33%;
  float: left;
  display: inline;
  padding: 5px;
  box-sizing:border-box;
  -moz-box-sizing:border-box;
  -webkit-box-sizing:border-box;}

svg {
  float:left;
  display:inline;
  background: rgba(255,255,255,0.1);
  width: 100%;
  max-width: 580px;
  height: 200px;
  padding: 50px;
  border: 3px solid rgba(255,255,255,0.3);
  box-sizing:border-box;
  -moz-box-sizing:border-box;
  -webkit-box-sizing:border-box;}
            
          
!
            
              // ---------
//  SVG A
// ---------

  var snapA = Snap("#svgA");

  // SVG A - "Squiggly" Path
  var myPathA = snapA.path("M62.9 14.9c-25-7.74-56.6 4.8-60.4 24.3-3.73 19.6 21.6 35 39.6 37.6 42.8 6.2 72.9-53.4 116-58.9 65-18.2 191 101 215 28.8 5-16.7-7-49.1-34-44-34 11.5-31 46.5-14 69.3 9.38 12.6 24.2 20.6 39.8 22.9 91.4 9.05 102-98.9 176-86.7 18.8 3.81 33 17.3 36.7 34.6 2.01 10.2.124 21.1-5.18 30.1").attr({
    id: "squiggle",
    fill: "none",
    strokeWidth: "4",
    stroke: "#ffffff",
    strokeMiterLimit: "10",
    strokeDasharray: "9 9",
    strokeDashOffset: "988.01"
  });

  // SVG A - Draw Path
  var len = myPathA.getTotalLength();

  // SVG1 - Animate Path
  myPathA.attr({
	  stroke: '#fff',
	  strokeWidth: 4,
    fill: 'none',
    // Animate Path
    "stroke-dasharray": "12 6",
    "stroke-dashoffset": len
  }).animate({"stroke-dashoffset": 10}, 2500,mina.easeinout);

  // SVG A - Circle
  var CircleA = snapA.circle(32,32,16);
  CircleA.attr({
    fill: "#3f4445",
    stroke: "#fff",
    strokeWidth: 2
  });

  setTimeout( function() {
    Snap.animate(0, len, function( value ) {
       movePoint = myPathA.getPointAtLength( value );
       CircleA.attr({ cx: movePoint.x, cy: movePoint.y }); // move along path via cx & cy attributes
    }, 2500,mina.easeinout);
  });



// ---------
//  SVG B
// ---------

  var snapB = Snap("#svgB");

  // SVG B - "Squiggly" Path
  var myPathB = snapB.path("M62.9 14.9c-25-7.74-56.6 4.8-60.4 24.3-3.73 19.6 21.6 35 39.6 37.6 42.8 6.2 72.9-53.4 116-58.9 65-18.2 191 101 215 28.8 5-16.7-7-49.1-34-44-34 11.5-31 46.5-14 69.3 9.38 12.6 24.2 20.6 39.8 22.9 91.4 9.05 102-98.9 176-86.7 18.8 3.81 33 17.3 36.7 34.6 2.01 10.2.124 21.1-5.18 30.1").attr({
    id: "squiggle",
    fill: "none",
    strokeWidth: "4",
    stroke: "#ffffff",
    strokeMiterLimit: "10",
    strokeDasharray: "9 9",
    strokeDashOffset: "988.01"
  });

  // SVG B - Draw Path
  var lenB = myPathB.getTotalLength();

  // SVG B - Animate Path
  myPathB.attr({
	  stroke: '#fff',
	  strokeWidth: 4,
    fill: 'none',
    // Draw Path
    "stroke-dasharray": lenB + " " + lenB,
    "stroke-dashoffset": lenB
  }).animate({"stroke-dashoffset": 10}, 2500,mina.easeinout);

  // SVG B - Circle
  var CircleB = snapB.circle(16,16,8);
  CircleB.attr({
    fill: "#3f4445",
    stroke: "#fff",
    strokeWidth: 2
  });

  setTimeout( function() {
    Snap.animate(0, lenB, function( value ) {
       movePoint = myPathB.getPointAtLength( value );
       CircleB.attr({ cx: movePoint.x, cy: movePoint.y }); // move along path via cx & cy attributes
    }, 2500,mina.easeinout);
  });



// ---------
//  SVG C
// ---------

  var snapC = Snap("#svgC"); 

  // SVG C - "Squiggly" Path
  var myPathC = snapC.path("M62.9 14.9c-25-7.74-56.6 4.8-60.4 24.3-3.73 19.6 21.6 35 39.6 37.6 42.8 6.2 72.9-53.4 116-58.9 65-18.2 191 101 215 28.8 5-16.7-7-49.1-34-44-34 11.5-31 46.5-14 69.3 9.38 12.6 24.2 20.6 39.8 22.9 91.4 9.05 102-98.9 176-86.7 18.8 3.81 33 17.3 36.7 34.6 2.01 10.2.124 21.1-5.18 30.1").attr({
    id: "squiggle",
    fill: "none",
    strokeWidth: "4",
    stroke: "#ffffff",
    strokeMiterLimit: "10",
    strokeDasharray: "9 9",
    strokeDashOffset: "988.01"
  });

  // SVG C - Draw Path
  var lenC = myPathC.getTotalLength();

  // SVG C - Animate Path
  myPathC.attr({
    stroke: '#fff',
    strokeWidth: 4,
    fill: 'none',
    // Draw Path
    "stroke-dasharray": "12 6",
    "stroke-dashoffset": "180"
  }).animate({"stroke-dashoffset": 10}, 4500,mina.easeinout);
 
  // SVG C - Triangle (As Polyline)
  var Triangle = snapC.polyline("0,30 15,0 30,30");
  Triangle.attr({
    id: "plane",
    fill: "#fff"
  });  

  var triangleGroup = snapC.g( Triangle ); // Group polyline

  setTimeout( function() {
    Snap.animate(0, lenC, function( value ) {
       movePoint = myPathC.getPointAtLength( value );
       triangleGroup.transform( 't' + parseInt(movePoint.x - 15) + ',' + parseInt( movePoint.y - 15) + 'r' + (movePoint.alpha - 90));
    }, 4500,mina.easeinout);
  });
            
          
!
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.
Loading ..................

Console