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 id="avengers">
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <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" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_3" x="0" y="0" viewBox="-400 -100 1000 1000" xml:space="preserve" enable-background="new -400 -100 1000 1000" inkscape:version="0.91 r13725" sodipodi:docname="test1_path.svg">
  <defs id="defs3621"/>
  <style type="text/css" id="style3337"> 
	</style>
  <g id="amer">
    <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="398" y1="191.21" x2="391.38" y2="188.21">
      <stop id="colora1" offset="0.03" stop-color="#ACAD9D"/>
      <stop id="colora2" offset="0.25" stop-color="#B7B6A4"/>
      <stop id="colora3" offset="0.67" stop-color="#C7C2AE"/>
      <stop id="colora4" offset="1" stop-color="#CDC6B2"/>
	      <stop id="colora5" offset="1" stop-color="#CDC6B2"/>    
    </linearGradient>
    <path id="amer1" style="fill:url(#SVGID_1_)" d="m 387,184.2 15.1,3.4 -3.1,9.5 z" />
  </g>
  <g id="hulk" style="visibility:hidden">
    <linearGradient id="SVGID_1a_" gradientUnits="userSpaceOnUse" x1="217.31" y1="210.12" x2="222.98" y2="195.89">
      <stop id="colork1" offset="0" stop-color="#DCE1BF"/>
      <stop id="colork2" offset="0.12" stop-color="#CED3B3"/>
      <stop id="colork3" offset="0.36" stop-color="#AAB094"/>
      <stop id="colork4" offset="0.67" stop-color="#707662"/>
      <stop id="colork5" offset="1" stop-color="#2C3228"/>
    </linearGradient>
    <path id="hulk1" style="fill:url(#SVGID_1a_)" d="m 218.8,188.2 10.6,21.1 -27.7,10.3 z" />
  </g>
</svg>
              
            
!

CSS

              
                body,
html {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background-color: black;
}

#avengers {
  margin: auto;
  text-align: center;
  max-width:800px;
}

#hulk{
	margin: auto;
	text-align: center;
}

.st0 {
     fill:url(#SVGID_1_);
 }
 .st1 {
     fill:url(#SVGID_2_);
 }
 .st2 {
     fill:url(#SVGID_3_);
 }
 .st3 {
     fill:url(#SVGID_4_);
 }
 .st4 {
     fill:url(#SVGID_5_);
 }
 .st5 {
     fill:url(#SVGID_6_);
 }
 .st6 {
     fill:url(#SVGID_7_);
 }
 .st7 {
     fill:url(#SVGID_8_);
 }
 .st8 {
     fill:url(#SVGID_9_);
 }
 .st9 {
     fill:url(#SVGID_10_);
 }
 .st10 {
     fill:url(#SVGID_11_);
 }
 .st11 {
     fill:url(#SVGID_12_);
 }


 .st0a {
     fill:url(#SVGID_1a_);
 }
 .st1a {
     fill:url(#SVGID_2a_);
 }
 .st2a {
     fill:url(#SVGID_3a_);
 }
 .st3a {
     fill:url(#SVGID_4a_);
 }
 .st4a {
     fill:url(#SVGID_5a_);
 }
 .st5a {
     fill:url(#SVGID_6a_);
 }
 .st6a {
     fill:url(#SVGID_7a_);
 }
 .st7a {
     fill:url(#SVGID_8a_);
 }
 .st8a {
     fill:url(#SVGID_9a_);
 }
 .st9a {
     fill:url(#SVGID_10a_);
 }
 .st10a {
     fill:url(#SVGID_11a_);
 }
 .st11a {
     fill:url(#SVGID_12a_);
 }
              
            
!

JS

              
                /*seperate path's and linear gradients of SVG in their own variables for later use*/
var amerpoly = document.getElementById('amer').querySelectorAll('path');
var hulkpoly = document.getElementById('hulk').querySelectorAll('path');
var amergradient = document.getElementById('amer').querySelectorAll('linearGradient');
var hulkgradient = document.getElementById('hulk').querySelectorAll('linearGradient');

/* Go through all the paths and gradients in one group */
  for (var index = 0; index < amerpoly.length; index++)
  {
    var trenutniGradientStop = hulkgradient[index].querySelectorAll('stop');
    /* Calculate random time which will be used for animation speed */
    var randomTime = (Math.random() +0.001) * 4; 
    /*initialize arrays for extraction of elemenets*/
    var stopColorArray = [];
    var offsetArray = [];
    /*Loop through elemenets in each gradient and store them in an array*/
      for(var elem = 0; elem < trenutniGradientStop.length; elem++)
        { 
          stopColorArray.push(trenutniGradientStop[elem].getAttribute('stop-color'));
          offsetArray.push(trenutniGradientStop[elem].getAttribute('offset'));
        }

    /*Morph the path/path's and morph the coordinates of the gradient*/
    TweenLite.to(amerpoly[index], randomTime, {morphSVG:hulkpoly[index]});
    TweenLite.to(amergradient[index].x1, randomTime, {morphSVG:hulkgradient[index].x1});
    TweenLite.to(amergradient[index].y1, randomTime, {morphSVG:hulkgradient[index].y1});
    TweenLite.to(amergradient[index].x2, randomTime, {morphSVG:hulkgradient[index].x2});
    TweenLite.to(amergradient[index].y2, randomTime, {morphSVG:hulkgradient[index].y2});
    
    if(window.console) console.log('#'+amergradient[index].id + ' stop');
    
    /*staggerTo gradient by using the arrays in which they are stored*/
    TweenMax.staggerTo('#'+amergradient[index].id + ' stop', randomTime, {
      cycle:{
        stopColor: stopColorArray,
        offset: offsetArray
      }
    }, 0.1, 0);
    
    /*reinitialize the arrays*/
    stopColorArray.length = 0;
    offsetArray.length = 0;
  };


              
            
!
999px

Console