Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 >
    <svg viewBox="0 0 200 130" width="200" class="row1 col3">
        <polygon fill="#ff0000" points="0,57.78 100,0 200,57.77 100.01,115.56 	"/>
        <polygon fill="#E6E7E8" points="0,57.78 0,72.22 100,130 100.01,115.56 "/>
        <polygon fill="#D1D3D4" points="100.01,115.56 200,57.77 200,72.23 100,130 "/>
    </svg>
    <svg  viewBox="0 0 200 130" width="200" class="row2 col4">
        <polygon fill="#00ff00" points="0,57.78 100,0 200,57.77 100.01,115.56 	"/>
        <polygon fill="#E6E7E8" points="0,57.78 0,72.22 100,130 100.01,115.56 "/>
        <polygon fill="#D1D3D4" points="100.01,115.56 200,57.77 200,72.23 100,130 "/>
    </svg>
    <svg  viewBox="0 0 200 130" width="200" class="row3 col3">
        <polygon fill="#ffff00" points="0,57.78 100,0 200,57.77 100.01,115.56 	"/>
        <polygon fill="#E6E7E8" points="0,57.78 0,72.22 100,130 100.01,115.56 "/>
        <polygon fill="#D1D3D4" points="100.01,115.56 200,57.77 200,72.23 100,130 "/>
    </svg>
    <svg  viewBox="0 0 200 130" width="200" class="row4 col2">
        <polygon fill="#0000ff" points="0,57.78 100,0 200,57.77 100.01,115.56 	"/>
        <polygon fill="#E6E7E8" points="0,57.78 0,72.22 100,130 100.01,115.56 "/>
        <polygon fill="#D1D3D4" points="100.01,115.56 200,57.77 200,72.23 100,130 "/>
    </svg>
    <svg  viewBox="0 0 200 130" width="200" class="row4 col4">
        <polygon fill="#00ffff" points="0,57.78 100,0 200,57.77 100.01,115.56 	"/>
        <polygon fill="#E6E7E8" points="0,57.78 0,72.22 100,130 100.01,115.56 "/>
        <polygon fill="#D1D3D4" points="100.01,115.56 200,57.77 200,72.23 100,130 "/>
    </svg>
</div>
              
            
!

CSS

              
                div {
  position: relative;
}
svg {
  position: absolute;
  transition: all .4s cubic-bezier(0.75, 0, 0.5, 1);
}
.row1 { top: 0; }
.row2 { top: 59px; }
.row3 { top: 118px; }
.row4 { top: 177px; }
.row5 { top: 236px; }

.col1 { left: 0; }
.col2 { left: 101px; }
.col3 { left: 202px; }
.col4 { left: 303px; }
.col5 { left: 404px; }

.row1.col1 { z-index: 14; }
.row1.col2 { z-index: 13; }
.row1.col3 { z-index: 12; }
.row1.col4 { z-index: 11; }
.row1.col5 { z-index: 10; }

.row2.col1 { z-index: 24; }
.row2.col2 { z-index: 23; }
.row2.col3 { z-index: 22; }
.row2.col4 { z-index: 21; }
.row2.col5 { z-index: 20; }

.row3.col1 { z-index: 34; }
.row3.col2 { z-index: 33; }
.row3.col3 { z-index: 32; }
.row3.col4 { z-index: 31; }
.row3.col5 { z-index: 30; }

.row4.col1 { z-index: 44; }
.row4.col2 { z-index: 43; }
.row4.col3 { z-index: 42; }
.row4.col4 { z-index: 41; }
.row4.col5 { z-index: 40; }

.row5.col1 { z-index: 54; }
.row5.col2 { z-index: 53; }
.row5.col3 { z-index: 52; }
.row5.col4 { z-index: 51; }
.row5.col5 { z-index: 50; }

              
            
!

JS

              
                
var SEQUENCE_DELAY = 2000;
var MOVE_DELAY = 300;
var moveSequence = [
  [
    {selector: '.row4.col4', target: 'row5 col3'},
    {selector: '.row3.col3', target: 'row4 col4'},
    {selector: '.row2.col4', target: 'row3 col3'},
    {selector: '.row1.col3', target: 'row2 col4'}
  ],
  [
    {selector: '.row4.col2', target: 'row3 col1'},
    {selector: '.row5.col3', target: 'row4 col2'},
    {selector: '.row2.col4', target: 'row3 col5'},
    {selector: '.row3.col1', target: 'row2 col2'}
  ],
  [
    {selector: '.row2.col2', target: 'row1 col3'},
    {selector: '.row3.col3', target: 'row2 col4'},
    {selector: '.row4.col4', target: 'row3 col3'},
    {selector: '.row3.col5', target: 'row4 col4'}
  ]
];

function triggerMove() {
  var moves = moveSequence.shift(),
      delay = 0;

  moveSequence.push(moves);

  for (var i = 0; i < moves.length; i++) {
    setTimeout(function(item, target) {
      $(item).removeClass().addClass(target);
    }, delay, moves[i]['selector'], moves[i]['target']);
    delay += MOVE_DELAY;
  }

  setTimeout(triggerMove, delay + SEQUENCE_DELAY);

}

triggerMove();
              
            
!
999px

Console