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.

            
              <body>
   <div class="dial">
      <div class="dot"></div>
      <div class="sec-hand"></div>
      <div class="sec-hand shadow"></div>
      <div class="min-hand"></div>
      <div class="min-hand shadow"></div>
      <div class="hour-hand"></div>
      <div class="hour-hand shadow"></div>
      <span class="twelve">12</span>
      <span class="three">3</span>
      <span class="six">6</span>
      <span class="nine">9</span>
      <span class="diallines"></span>
      <div class="date"></div>
   </div>
</body>
            
          
!
            
              body {
   background: #ccc;
}

.dial {
   position: relative;
   width: 350px;
   height: 350px;
   background: #ececec;
   border: 12px solid #5c5c5c;
   border-radius: 50%;
   margin: 8% auto 0;
   box-shadow: 1px 14px 21px 0 rgba(0,0,0,.2);
}

span {
   display: inline-block;
}

.dot {
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   margin: auto;
   width: 16px;
   height: 16px;
   border-radius: 50%;
   background: radial-gradient(ellipse 20px 15px at 50% 0, #ececec 40%, #5c5c5c 80%);
   z-index: 10;
   box-shadow: 0 2px 5px 0 rgba(0,0,0,.3);
}

.sec-hand {
   position: absolute;
   top: 39px;
   left: 50%;
   margin-left: -7px;
   width: 14px;
   height: 162px;
   background: url('https://themegion.github.com/AnalogClock/sec.svg') 50% 50% no-repeat;
   z-index: 9;
   transform-origin: 50% 136px;
}

.sec-hand.shadow {
   top: 46px;
   margin-left: -4px;
   background-image: url('https://themegion.github.com/AnalogClock/sec-shdw.svg');
   opacity: .1;
   z-index: 8;
   filter: blur(2px);
}

.min-hand {
   position: absolute;
   top: 51px;  
   left: 50%;
   margin-left: -8px;
   width: 16px;
   height: 144px;
   background: url('https://themegion.github.com/AnalogClock/min.svg') 50% 50% no-repeat;
   z-index: 7;
   transform-origin: 50% 124px;
}

.min-hand.shadow {
   top: 58px;
   margin-left: -5px;
   background-image: url('https://themegion.github.com/AnalogClock/min-shdw.svg');
   opacity: .1;
   z-index: 6;
   filter: blur(2px);
}

.hour-hand {
   position: absolute;
   top: 85px;
   left: 50%;
   margin-left: -7px;
   width: 14px;
   height: 110px;
   background: url('https://themegion.github.com/AnalogClock/hour.svg') 50% 50% no-repeat;
   z-index: 5;
   transform-origin: 50% 90px;
}

.hour-hand.shadow {
   top: 92px;
   margin-left: -4px;
   background-image: url('https://themegion.github.com/AnalogClock/hour-shdw.svg');
   opacity: .1;
   z-index: 4;
   filter: blur(2px);
}

.twelve,
.three,
.six,
.nine {
   position: absolute;
   font-family: Lato, sans-serif;
   font-size: 32px;
   color: #777;
}

.twelve {
   top: 35px;
   left: 155px;
}

.three {
   top: 156px;
   right: 39px;
}

.six {
   left: 165px;
   bottom: 35px;
}

.nine {
   top: 156px;
   left: 39px;
}

.diallines {
   position: absolute;
   top: 15px;
   left: 50%;
   margin-left: -1px;
   width: 2px;
   height: 10px;
   background: #b3b3b0;
   z-index: 1;
   transform-origin: 50% 160px;
}

.diallines:nth-of-type(5n) {
   position: absolute;
   top: 10px;
   left: 50%;
   margin-left: -2px;
   width: 4px;
   height: 25px;
   background: #b3b3b0;
   z-index: 1;
   transform-origin: 50% 165px;
}

.date {
   position: absolute;
   top: 242px;
   left: 50%;
   margin-left: -18px;
   width: 36px;
   height: 30px;
   background: #83837a;
   border-radius: 6px;
   font-family: 'Fjalla One', sans-serif;
   font-size: 21px;
   line-height: 30px;
   color: white;
   text-align: center;
   box-shadow: inset 0 2px 2px 0 rgba(0,0,0,.3), inset 0 -2px 2px 0 rgba(255,255,255,.2);
}
            
          
!
            
              var dialLines = document.getElementsByClassName('diallines');

for (var i = 1; i < 60; i++) {
   dialLines[i] = $(dialLines[i-1]).clone()
                                   .insertAfter($(dialLines[i-1]));
   $(dialLines[i]).css('transform', 'rotate(' + 6 * i + 'deg)');
}

function tick() {
   var date = new Date();
   var seconds = date.getSeconds();
   var minutes = date.getMinutes();
   var hours = date.getHours();
   var day = date.getDate();
   
   var secAngle = seconds * 6;
   var minAngle = minutes * 6 + seconds * (360/3600);
   var hourAngle = hours * 30 + minutes * (360/720);
   
   $('.sec-hand').css('transform', 'rotate(' + secAngle + 'deg)');
   $('.min-hand').css('transform', 'rotate(' + minAngle + 'deg)');
   $('.hour-hand').css('transform', 'rotate(' + hourAngle + 'deg)');
   $('.date').text(day);
}

setInterval(tick, 100);

            
          
!
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