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. 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

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

              
                <!-- Use class .display-animation for your container -->
<h2 style="text-align: center;">Material Design Animation Timing</h2>
<ul id="demo" class="display-animation">
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>
              
            
!

CSS

              
                /* #demo style - you can delete it */
#demo {
  position: relative;
  margin: 30px auto;
  width: 455px;
  padding: 0;
}

#demo > * {
  display: inline-block;
  width: 100px;
  height: 100px;
  margin: 5px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  border: none;
  border-radius: 2px;
 /* -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.24);
  -moz-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.24);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.24);*/
  background-color: #03a9f4;
}


              
            
!

JS

              
                /**
 * Forked from: Kupletsky Sergey https://codepen.io/zavoloklom/pen/Jbrho/?editors=011
 * original uses CSS animations
 *
 * Hierarchical timing
 * Add specific delay for GSAP animation to elements.
 */


var delayMultiplier = 0.0005;
var duration = 0.4;
var elements = $("#demo li");
var tl = new TimelineMax({repeat:-1, repeatDelay:1, onRepeat:changeTimeScale, yoyo:true});


//use this loop to create tweens for each box, but set the delay based on its x / y position

elements.each(function() {      
  var elementOffset = $(this).offset(); 
  var offset = elementOffset.left + elementOffset.top;
  var delay = parseFloat(offset * delayMultiplier).toFixed(2);
  tl.from(this, duration, {opacity:0, scale:0}, delay)

});

//this isn't necessary but it adds a nice extra effect of having the whole animation scale a little while the boxes are scaling. 
tl.from("#demo", tl.duration()+0.2, {scale:0.2, ease:Back.easeOut}, 0)

function changeTimeScale() {
  //play faster when it repeats in the "backwards" direction
  tl.timeScale(tl.timeScale() == 1 ? 1.5 : 1)
}

TweenLite.set(elements, {boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.24)"})


              
            
!
999px

Console