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

              
                <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'>

<div id="container">
  
  <div id="loader">
    <div class="left">
      <span class="anim green"></span>
      <span class="anim lightyellow delay1"></span>
      <span class="anim darkyellow delay2"></span>
      <span class="anim lightred delay3"></span>
      <span class="anim darkred delay4"></span>
    </div>
    <div class="right">
      <span class="anim green"></span>
      <span class="anim lightyellow delay1"></span>
      <span class="anim darkyellow delay2"></span>
      <span class="anim lightred delay3"></span>
      <span class="anim darkred delay4"></span>
    </div>
    
  </div>
  
  <p id="clock">
    <span class="hour"></span>
    <span class="minutes"></span>
    <span class="seconds"></span>
  </p>
  
  
</div>


              
            
!

CSS

              
                @import "compass/css3";

/*
  Learning some CSS Animations. First Attempt at a CSS 
  Animation Loader

  Inspired from https://codepen.io/CreativeJuiz/pen/vFBIh
*/

#loader {
  position: relative;
  width: 300px;
  height: 300px;
  overflow: hidden;
  
  background: #f1f1f1;
  @include border-radius(50%);
  @include box-shadow(0 0 15px 0 rgba(0, 0, 0, 0.5) inset);
  
  .left,
  .right {
    position: absolute;
    height: 100%;
    width: 50%;
    overflow: hidden;
  }
  
  .anim {
    position: absolute;
    left: 100%;
    top: 0%;
    height: 100%;
    width: 100%;
    opacity: 0.5;
    
    @include border-radius(999px);
    -webkit-animation: loader-rotate-left 5s infinite;
    animation: loader-rotate-left 10s infinite;
    
    @include transform-origin(0, 50%, 0);
  }
  
  .delay1 {
    -webkit-animation-name: loader-rotate-left-delay1;
    animation-name: loader-rotate-left-delay1;
  }
  
  .delay2 {
    -webkit-animation-name: loader-rotate-left-delay2;
    animation-name: loader-rotate-left-delay2;
  }
  
  .delay3 {
    -webkit-animation-name: loader-rotate-left-delay3;
    animation-name: loader-rotate-left-delay3;
  }
  
  .delay4 {
    -webkit-animation-name: loader-rotate-left-delay4;
    animation-name: loader-rotate-left-delay4;
  }
  
  .left {
    left: 0;
    
    .anim {
      @include border-radius(0 999px 999px 0);
    }
  }
  
  .right {
    left: 50%;
    
    .anim {
      @include border-radius(999px 0 0 999px);
      left: -100%;
      @include transform-origin(100%, 50%, 0);
    }
    
  }
  
  /* Theme 2.0 */
  .green {background: #3B6969;}
  .lightyellow {background: #FFDCA0;}
  .darkyellow {background: #FFC566;}
  .lightred {background: #DB746D;}
  .darkred {background: #BC4B47;}
  
  /* Theme 1.0 */
  .pink {background: #FD6E8A;}
  .navy { background: #2C3B63;}
  .purple {background: #250352;}
  .cream {background: #ECE59A;}
  .grey {background: #848D82;}
  
  &:after {
    content: "";
    display: block;
    
    position: absolute;
    top: 50px;
    left: 50px;
    width: 200px;
    height: 200px;
    
    background: #fafafa;
    @include border-radius(50%);
    @include box-shadow(0 0 15px 0 rgba(0, 0, 0, 0.5));
  }
}


#clock {
  position: absolute;
  top: 100px;
  box-sizing: border-box;
  
  margin: 0;
  padding: 50px;
  
  width: 300px;
  height: 300px;
  
  text-align: center;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 40px;
  font-weight: bold;
  line-height: 68px;
  color: #999;
  
  text-shadow: 0px -1px 1px #555,
    1px 1px 1px #fff;
  
  span {
    display: block;
  }
}

/* KEYFRAMES */

@keyframes loader-rotate-left{
  0%{transform:rotate(0deg)}
  20%{transform:rotate(180deg)}
  40%{transform:rotate(360deg)}
  60%{transform:rotate(360deg)}
  80%{transform:rotate(360deg)}
  100%{transform:rotate(360deg)}
}

@-webkit-keyframes loader-rotate-left{
  0%{-webkit-transform:rotate(0deg)}
  20%{-webkit-transform:rotate(180deg)}
  40%{-webkit-transform:rotate(360deg)}
  60%{-webkit-transform:rotate(360deg)}
  80%{-webkit-transform:rotate(360deg)}
  100%{-webkit-transform:rotate(360deg)}
}

/* Delay 1 */

@keyframes loader-rotate-left-delay1 {
  0%{transform:rotate(0deg)}
  20%{transform:rotate(0deg)}
  40%{transform:rotate(180deg)}
  60%{transform:rotate(360deg)}
  80%{transform:rotate(360deg)}
  100%{transform:rotate(360deg)}
}

@-webkit-keyframes loader-rotate-left-delay1 {
  0%{-webkit-transform:rotate(0deg)}
  20%{-webkit-transform:rotate(0deg)}
  40%{-webkit-transform:rotate(180deg)}
  60%{-webkit-transform:rotate(360deg)}
  80%{-webkit-transform:rotate(360deg)}
  100%{-webkit-transform:rotate(360deg)}
}

/* Delay 2 */

@keyframes loader-rotate-left-delay2 {
  0%{transform:rotate(0deg)}
  20%{transform:rotate(0deg)}
  40%{transform:rotate(0deg)}
  60%{transform:rotate(180deg)}
  80%{transform:rotate(360deg)}
  100%{transform:rotate(360deg)}
}

@-webkit-keyframes loader-rotate-left-delay2 {
  0%{-webkit-transform:rotate(0deg)}
  20%{-webkit-transform:rotate(0deg)}
  40%{-webkit-transform:rotate(0deg)}
  60%{-webkit-transform:rotate(180deg)}
  80%{-webkit-transform:rotate(360deg)}
  100%{-webkit-transform:rotate(360deg)}
}

/* Delay 3 */

@keyframes loader-rotate-left-delay3 {
  0%{transform:rotate(0deg)}
  20%{transform:rotate(0deg)}
  40%{transform:rotate(0deg)}
  60%{transform:rotate(0deg)}
  80%{transform:rotate(180deg)}
  100%{transform:rotate(360deg)}
}

@-webkit-keyframes loader-rotate-left-delay3 {
  0%{-webkit-transform:rotate(0deg)}
  20%{-webkit-transform:rotate(0deg)}
  40%{-webkit-transform:rotate(0deg)}
  60%{-webkit-transform:rotate(0deg)}
  80%{-webkit-transform:rotate(180deg)}
  100%{-webkit-transform:rotate(360deg)}
}

/* Delay 4 */

@keyframes loader-rotate-left-delay4 {
  0%{transform:rotate(0deg)}
  20%{transform:rotate(0deg)}
  40%{transform:rotate(0deg)}
  60%{transform:rotate(0deg)}
  80%{transform:rotate(0deg)}
  100%{transform:rotate(180deg)}
}

@-webkit-keyframes loader-rotate-left-delay4 {
  0%{-webkit-transform:rotate(0deg)}
  20%{-webkit-transform:rotate(0deg)}
  40%{-webkit-transform:rotate(0deg)}
  60%{-webkit-transform:rotate(0deg)}
  80%{-webkit-transform:rotate(0deg)}
  100%{-webkit-transform:rotate(180deg)}
}


/*display*/

html {
  height: 100%;
}

body {
  background: -webkit-radial-gradient(circle, #fff 0%, #ddd 80%);
  height: 100%;
}

#container {
  width: 300px;
  height: 300px;
  margin: 100px auto;
}


              
            
!

JS

              
                
function updateTime() {
  
  $clock = $('#clock');

  var today = new Date();
  var h = today.getHours();
  var m = today.getMinutes();
  var s = today.getSeconds();

  h = leadingZeros(h);
  m = leadingZeros(m);
  s = leadingZeros(s);
  
  $clock.find('.hour').html(h);
  $clock.find('.minutes').html(m);
  $clock.find('.seconds').html(s);
  
  
  //$clock.html(h + '\n\r' + m + '\n\r' + s );
}


setInterval(function(){updateTime()}, 1000);


function leadingZeros(num) {
  if(num < 10) {
    num = "0"+num;
  }
  return num;
}
              
            
!
999px

Console