css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

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


            
          
!
            
              @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;
}


            
          
!
            
              
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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console