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">
  
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="170px" height="170px" viewBox="-314 316 170 170" enable-background="new -314 316 170 170">
  <g id="Icons">
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-212.9,439.5h28.5c11.6,0,21.1,8.4,21.1,18.7v23.3"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-298,481.5v-23.3c0-10.3,9.4-18.7,21.1-18.7h28.5"/>
    <polyline fill="none" stroke="#282D33" stroke-width="4" points="-212.9,427.2 -212.9,439.7 -230.6,449.9 -248.4,439.7 -248.4,425.9"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-189.6,396.5c-3.3,19.5-20.1,34.3-40.3,34.3l0,0c-19.6,0-36-14-39.9-32.6 c-0.3-1.6-0.6-3.3-0.8-5"/>
    <line fill="none" stroke="#282D33" stroke-width="4" x1="-244" y1="377.8" x2="-251.6" y2="377.8"/>
    <line fill="none" stroke="#282D33" stroke-width="4" x1="-209.2" y1="377.8" x2="-216.7" y2="377.8"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-211.3,407.1c-0.4-6.3-5.7-11.3-12.1-11.3h-13.9c-6.4,0-11.7,5-12.1,11.3 H-211.3z"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-182.4,378l2.6-36.6c0-8-6.3-14.6-14-14.8v-2.7c0-3.8-3.1-7-6.8-7h-59.6 c-3.8,0-6.8,3.1-6.8,7v2.7c-7.8,0.3-14,6.8-14,14.8l2.6,36.1"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-270.8,397.1c0,0,3.1-39.2,7.3-52.1l33.1,6.1l33.1-6.1 c4.2,12.8,7.3,52.1,7.3,52.1"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-267.5,374.4c-4.1,0-11.1,2.4-11.4,6.1l-1.2,13.2 c-0.3,3.7,6.1,7.3,10.1,8.1"/>
    <path fill="none" stroke="#282D33" stroke-width="4" d="M-193.9,374.4c4.1,0,11.1,2.4,11.4,6.1l1.2,13.2c0.3,3.7-6.1,7.3-10.1,8.1"/>
    <polyline fill="none" stroke="#282D33" stroke-width="4" points="-220.8,458.9 -225.7,467.4 -235.5,467.4 -240.4,458.9"/>
    <polyline fill="none" stroke="#282D33" stroke-width="4" points="-238.7,482.9 -235.5,467.4 -225.7,467.4 -222.6,482.9"/>
    <polygon fill="none" stroke="#282D33" stroke-width="4" points="-250.3,463.4 -230.7,450.5 -248.7,440"/>
    <polygon fill="none" stroke="#282D33" stroke-width="4" points="-211,463.4 -230.6,450.5 -212.5,440"/>
    <line fill="none" stroke="#282D33" stroke-width="4" x1="-179.2" y1="477.7" x2="-204.7" y2="477.7"/>
  </g>
</svg>
  
</div>
              
            
!

CSS

              
                html, body {
  height: 100%;
  background: black;
}

body {
  overflow: hidden;
}

.container {
  width: 170px;
  position: relative;
  margin: 0 auto;
  text-align: center;
}

svg {
/*   background: rgb(0,0,17); */
  width: 100%;
  height: 100%;
}

.path {
  fill: none;
  stroke-width: 40;
}

button {
  background: blue;
  color: white;
  font-size: 
}
              
            
!

JS

              
                
MorphSVGPlugin.convertToPath("circle, rect, ellipse, line, polygon, polyline");
TweenLite.defaultEase = Linear.easeNone;

var root = document.querySelector("svg");
var path = document.querySelector("path");

// var selectorsArr = document.querySelectorAll("path,line,polyline,polygon,ellipse,circle,rect");
var selectorsArr = document.querySelectorAll("path");

gradPertify(selectorsArr);

function gradPertify(selectorsArr) {
  [].forEach.call(selectorsArr, function(sel) {
    var total = 40;
    var space = 2;
    // var length = getLength(sel);
    var length = path.getTotalLength();
    var offset = length / total;
    var colors = [
      [32, 255, 219],
      [231, 0, 77],
      [241, 206, 74]
    ];
    colors.sort(function() { return 0.5 - Math.random() });
    if(length < 50 ) {
      // space = 15;
    }
    
    colors.push(colors[0].slice(0));
    var gradient = [];

    for(var i = 0; i < total; i++) { 
      var amt = i / (total - 1);
      var rgb = lerpColors(colors, amt).map(color => Math.round(color)); 
      gradient.push(`rgb(${rgb})`);
    }

    TweenLite.set(sel, { strokeDasharray: `${offset + space},${length - offset - space}` });

    var tl = gradient.reduce((tl, stroke, i) => {  

      var clone = sel.cloneNode(true);
      root.appendChild(clone);  
      TweenLite.set(clone, { stroke, strokeDashoffset: -i * offset });  
      return tl.to(clone, 2, { strokeDashoffset: `+=${length}` }, 0);  
    }, new TimelineMax({ repeat: -1 }));

  });
}

TweenMax.fromTo("#Layer_1", 0.5, {rotation: "-2%"}, {rotation: "+2%"}).repeat(-1).yoyo(true);

function lerp(start, end, amt) { 
  return start + (end - start) * amt; 
}

function lerpColor(start, end, amt) { 
  var rgb = [];
  for(var i = 0; i < start.length; i++) {
    rgb[i] = lerp(start[i], end[i], amt);
  }
  return rgb;
}

function lerpColors(colors, amt) {
  if (amt >= 1) return colors[colors.length - 1];
  amt *= (colors.length - 1);
  var i = amt >> 0;
  return lerpColor(colors[i], colors[i + 1], amt - i);
}

// function getLength(el) {
//   var node = el.nodeName;
//   switch(node) {
//     case 'polyline':
//       return polylineLength(el);
//       break;
//     case 'circle':
//       return circleLength(el);
//       break;
//     case 'ellipse':
//       return ellipseLength(el);
//       break;
//     case 'path':
//       return el.getTotalLength();
//       break;
//     case 'line':
//       return lineLength(el);
//       break;
//     case 'rect':
//       return rectLength(el);
//       break;
//     case 'polygon':
//       return polygonLength(el);
//       break;
//   }
// }

// function lineLength(line) {
//   var x1 = line.getAttribute('x1'), x2 = line.getAttribute('x2'),
//       y1 = line.getAttribute('y1'), y2 = line.getAttribute('y2');
//   return Math.sqrt(Math.pow((x2-x1), 2)+Math.pow((y2-y1),2));
// }

// function rectLength(rect){
//     var w = rect.getAttribute('width');
//     var h = rect.getAttribute('height');
//     return (w*2)+(h*2);
// }

// function ellipseLength(ellipse) {
// //  PI * SquareRoot of 2 * ((1/2 long axis)squared + (1/2 short axis)squared)
//   var cx = ellipse.getAttribute('cx');
//   var cy = ellipse.getAttribute('cy');
//   var lng, shrt;
//   if (cx > cy) {
//     lng = cx;
//     shrt = cy;
//   } else {
//     lng = cy;
//     shrt = cx;
//   }
//   var halfLng = lng/2;
//   var halfShrt = shrt/2;
//   var length = Math.PI * Math.sqrt(2) * ( Math.pow(halfLng,2) + Math.pow(halfShrt,2) );
//   return length;
// }

// function circleLength(cir) {
//   var r = cir.getAttribute('r');
//   var length = 2 * Math.PI * r;
//   return length;
// }

// function polylineLength(polyline) {
//   function dis(p,q){
//     return Math.sqrt((p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y));
//   }
//   var ps = polyline.points, n = ps.numberOfItems, len=0;
//   for(var i=1; i<n; i++){
//     len += dis(ps.getItem(i-1),ps.getItem(i));
//   }

//   return len;
// }

// function polygonLength(poly)
// {
//   var pointList=poly.points;
//   var n=pointList.numberOfItems;
//   var totalLength = 0;
//   for(var k=0;k<n;k++)
//   {
//     var x1=pointList.getItem(k).x
//     var y1=pointList.getItem(k).y
//     if(k<n-1)
//     {
//       var x2=pointList.getItem(k+1).x
//       var y2=pointList.getItem(k+1).y
//     }
//     else
//     {
//       var x2=pointList.getItem(0).x
//       var y2=pointList.getItem(0).y
//     }

//     var ln=Math.sqrt( (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1) )
//     var lnRnd=Math.round(ln*100)/100
//     totalLength+=ln;
//   }
//   return totalLength;
// }


              
            
!
999px

Console