cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <div class="wrapper">
  <div class="hours">
    <div class="digit">
      <div class="clock" id="clock-1">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-2">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-3">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-4">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-5">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-6">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-7">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-8">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-9">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-10">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-11">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-12">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-13">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-14">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-15">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-16">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-17">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-18">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
    </div>
    <div class="digit">
      <div class="clock" id="clock-1">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-2">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-3">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-4">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-5">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-6">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-7">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-8">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-9">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-10">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-11">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-12">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-13">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-14">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-15">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-16">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-17">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-18">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
    </div>
  </div>
  <div class="sep">
  <div class="clock"><span id="hand-1"></span><span id="hand-2"></span></div>
  <div class="clock"><span id="hand-1"></span><span id="hand-2"></span></div>
  <div class="clock"><span id="hand-1"></span><span id="hand-2"></span></div>
  <div class="clock"><span id="hand-1"></span><span id="hand-2"></span></div>
  <div class="clock"><span id="hand-1"></span><span id="hand-2"></span></div>
  <div class="clock"><span id="hand-1"></span><span id="hand-2"></span></div>
</div>
  <div class="minutes">
    <div class="digit">
      <div class="clock" id="clock-1">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-2">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-3">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-4">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-5">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-6">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-7">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-8">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-9">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-10">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-11">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-12">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-13">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-14">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-15">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-16">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-17">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-18">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
    </div>
    <div class="digit">
      <div class="clock" id="clock-1">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-2">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-3">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-4">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-5">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-6">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-7">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-8">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-9">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-10">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-11">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-12">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-13">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-14">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-15">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-16">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-17">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
      <div class="clock" id="clock-18">
        <span id="hand-1"></span>
        <span id="hand-2"></span></div>
    </div>
  </div>
</div>
            
          
!
            
              @mixin top-left {
  #hand-1 {
    transform: rotate(0deg);
  }
  #hand-2 {
    transform: rotate(90deg);
  }
}

@mixin top-right {
  #hand-1 {
    transform: rotate(180deg);
  }
  #hand-2 {
    transform: rotate(90deg);
  } 
}

@mixin bottom-left {
  #hand-1 {
    transform: rotate(270deg);
  }
  #hand-2 {
    transform: rotate(0deg);
  } 
}

@mixin bottom-right {
  #hand-1 {
    transform: rotate(270deg);
  }
  #hand-2 {
    transform: rotate(180deg);
  } 
}

@mixin vert {
  #hand-1 {
    transform: rotate(270deg);
  }
  #hand-2 {
    transform: rotate(90deg);
  } 
}

@mixin hor {
  #hand-1 {
    transform: rotate(0deg);
  }
  #hand-2 {
    transform: rotate(180deg);
  } 
}

@mixin top-hole {
  #hand-1 {
    transform: rotate(60deg);
  }
  #hand-2 {
    transform: rotate(120deg);
  } 
}

@mixin bottom-hole {
  #hand-1 {
    transform: rotate(240deg);
  }
  #hand-2 {
    transform: rotate(300deg);
  } 
}

@keyframes spin-one{
  0% {
      transform: rotate(0deg);
    }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spin-two{
  0% {
      transform: rotate(180deg);
    }
  100% {
    transform: rotate(540deg);
  }
}

html, body {
  height: 100%;
}

body {
  background: #dedede;
  background: linear-gradient(45deg, #dedede 0%, #efefef 100%);
}

.wrapper {
  width:100%;
  min-width:840px;
  height:100%;
  display:flex;
  align-items: center;
  justify-content:center;
}

.digit {
  max-width: calc((60px + 4px) * 3);
  float:left;
}

.sep {
  max-width: calc((60px + 4px) * 1);
  float:left;
  .clock {
    #hand-1 {
      animation: spin-one 10s linear infinite;
    }
    #hand-2 {
      animation: spin-two 10s linear infinite alternate;
    }
  }
}

.clock {
  width: 60px;
  height: 60px;
  background: linear-gradient(270deg, #eee 0%, #fff 100%);
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  border-radius: 100%;
  position: relative;
  margin:2px;
  float:left;
  
  span {
    position: absolute;
    top:calc(50% - 1px);
    left: 50%;
    width:49%;
    height: 2px;
    background: #323232;
    transform-origin: 0% 50%;
    transform: rotate(270deg);
    
    transition: all ease 2s;
    
    &:before {
      content:'';
      position: absolute;
      top: 0;
      left: -1px;
      width: 2px;
      height: 2px;
      display: block;
      background: inherit;
      border-radius: 100%;
    }
  }
}


#clock {
  &-1, &-9 {
    #hand {
      &-1{
        transition: all ease-in 1.5s;  
      }
      &-2{
        transition: all ease 2s;
      }
    }
  }

  &-2, &-10 {
    #hand {
      &-1{
        transition: all ease-out 4s;  
      }
      &-2{
        transition: all ease-in 1.75s;
      }
    }
  }

  &-3, &-11 {
    #hand {
      &-1{
        transition: all linear 3s;  
      }
      &-2{
        transition: all ease-in 1s;
      }
    }
  }

  &-4, &-12 {
    #hand {
      &-1{
        transition: all ease-out 2.3s;  
      }
      &-2{
        transition: all ease 2.15s;
      }
    }
  }

  &-5, &-13 {
    #hand {
      &-1{
        transition: all ease-in 4s;  
      }
      &-2{
        transition: all ease-out 3s;
      }
    }
  }

  &-6, &-14, &-18 {
    #hand {
      &-1{
        transition: all linear 2.3s;  
      }
      &-2{
        transition: all ease-out 1.2s;
      }
    }
  }

  &-7, &-15 {
    #hand {
      &-1{
        transition: all ease-in 4s;  
      }
      &-2{
        transition: all ease 1.5s;
      }
    }
  }

  &-8, &-16 {
    #hand {
      &-1{
        transition: all ease 2s;  
      }
      &-2{
        transition: all ease 2.6s;
      }
    }
  }

  &-9, &-17 {
    #hand {
      &-1{
        transition: all linear 1.3s;  
      }
      &-2{
        transition: all ease 2.4s;
      }
    }
  }
}


.t-1 {
  #clock {
    &-2 {
      @include top-left;
    }
    &-3 {
      @include top-right;
    }
    &-5, &-6, &-8, &-9, &-11, &-12, &-14, &-15 {
      @include vert;
    }
    &-17 {
     @include bottom-left;
    }
    &-18 {
      @include bottom-right;
    }
  }
}

.t-2 {
  #clock {
    &-1, &-7, &-11 {
      @include top-left;
    }
    &-2, &-17 {
      @include hor;
    }
    &-3, &-15 {
      @include top-right;
    }
    &-4, &-14, &-16 {
      @include bottom-left;
    }
    &-5 {
      @include top-right;
    }
    &-6, &-9, &-10, &-13 {
      @include vert;
    }
    &-8, &-12, &-18 {
      @include bottom-right;
    }
  }
}

.t-3 {
  #clock {
    &-1, &-7, &-13 {
      @include top-left;
    }
    &-2, &-17 {
      @include hor;
    }
    &-3, &-11 {
      @include top-right;
    }
    &-4, &-10, &-16 {
      @include bottom-left;
    }
    &-5 {
      @include top-right;
    }
    &-6, &-9, &-12, &-15 {
      @include vert;
    }
    &-8,&-14, &-18 {
      @include bottom-right;
    }
  }
}

.t-4 {
  #clock {
    &-1 {
      @include top-left;
    }
    &-3, &-11 {
      @include top-right;
    }
    &-10, &-17 {
      @include bottom-left;
    }
    &-2  {
      @include top-right;
    }
    &-4, &-5, &-6, &-7, &-8, &-9, &-12, &-14, &-15 {
      @include vert;
    }
     &-18 {
      @include bottom-right;
    }
  }
}

.t-5 {
  #clock {
    &-1, &-5, &-13 {
      @include top-left;
    }
    &-2, &-17 {
      @include hor;
    }
    &-3, &-9, &-11 {
      @include top-right;
    }
    &-8, &-10, &-16 {
      @include bottom-left;
    }
    &-4, &-7, &-12, &-15 {
      @include vert;
    }
    &-6, &-14, &-18 {
      @include bottom-right;
    }
  }
}

.t-6 {
  #clock {
    &-1, &-5 {
      @include top-left;
    }
    &-3, &-9 {
      @include top-right;
    }
    &-8, &-16 {
      @include bottom-left;
    }
    &-6, &-18 {
      @include bottom-right;
    }
    &-2, &-17 {
      @include hor;
    }
    &-4, &-7, &-10, &-12, &-13, &-15 {
      @include vert;
    }
    &-11 {
      @include top-hole;
    }
    &-14 {
      @include bottom-hole;
    }
  }
}

.t-7 {
  #clock {
    &-1 {
      @include top-left;
    }
    &-2 {
      @include hor;
    }
    &-3, &-5 {
      @include top-right;
    }
    &-6, &-8, &-9, &-11, &-12, &-14, &-15 {
      @include vert;
    }
    &-4, &-17 {
     @include bottom-left;
    }
    &-18 {
      @include bottom-right;
    }
  }
}

.t-8 {
  #clock {
    &-1 {
      @include top-left;
    }
    &-3 {
      @include top-right;
    }
    &-16 {
      @include bottom-left;
    }
    &-18 {
      @include bottom-right;
    }
    &-2, &-17 {
      @include hor;
    }
    &-4, &-6, &-7, &-9, &-10, &-12, &-13, &-15 {
      @include vert;
    }
    &-5,&-11 {
      @include top-hole;
    }
    &-8, &-14 {
      @include bottom-hole;
    }
  }
}

.t-9 {
  #clock {
    &-1 {
      @include top-left;
    }
    &-3, &-11 {
      @include top-right;
    }
    &-10, &-17 {
      @include bottom-left;
    }
    &-18 {
      @include bottom-right;
    }
    &-2 {
      @include hor;
    }
    &-4, &-6, &-7, &-9, &-12, &-14, &-15 {
      @include vert;
    }
    &-5 {
      @include top-hole;
    }
    &-8 {
      @include bottom-hole;
    }
  }
}

.t-0 {
  #clock {
    &-1 {
      @include top-left;
    }
    &-3 {
      @include top-right;
    }
    &-16 {
      @include bottom-left;
    }
    &-18 {
      @include bottom-right;
    }
    &-2, &-17 {
      @include hor;
    }
    &-4, &-6, &-7, &-8, &-9, &-10, &-12, &-13,&-11, &-15 {
      @include vert;
    }
    &-5 {
      @include top-hole;
    }
    &-14 {
      @include bottom-hole;
    }
  }
}

            
          
!
            
              var currentDate,
  currentHours,
  currentMinutes,
  currentSeconds,
  hours = [],
  minutes = [],
  seconds = [];

function updateDate() {
  currentDate = new Date();
  currentHours = currentDate.getHours();
  if (currentHours < 10) {
    currentHours = '0' + currentHours;
  }
  currentMinutes = currentDate.getMinutes();
  if (currentMinutes < 10) {
    currentMinutes = '0' + currentMinutes;
  }
  currentSeconds = currentDate.getSeconds();
  if (currentSeconds < 10) {
    currentSeconds = '0' + currentSeconds;
  }
}

function splitDigits(stringVal, array) {
  var tempString = stringVal.toString();
  array.length = 0
  for (var i = 0; i < tempString.length; i++) {
    array.push(+tempString.charAt(i));
  }
}

function printClass(value, elem) {
  elem.attr('class', 'digit').addClass('t-'+value);
}

$(document).ready(function() {
  setInterval(function() {
    updateDate();
    splitDigits(currentSeconds, seconds);
    splitDigits(currentMinutes, minutes);
    splitDigits(currentHours, hours);

    printClass(hours[0], $('.hours .digit:first-of-type'));
    printClass(hours[1], $('.hours .digit:last-of-type'));
    printClass(minutes[0], $('.minutes .digit:first-of-type'));
    printClass(minutes[1], $('.minutes .digit:last-of-type'));
  }, 1000);
});
            
          
!
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