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="wd-clock">
  <div class="wd-clock__circle 
              wd-clock__circle--ms">
  </div>
  <div class="wd-clock__circle
              wd-clock__circle--s">
  </div>
  <div class="wd-clock__circle
              wd-clock__circle--m">
  </div>
  <div class="wd-clock__circle
              wd-clock__circle--h">
  </div>
  
  <div class="clock__digit
              clock__digit--h"></div>
  <div class="clock__digit
              clock__digit--m"></div>
  <div class="clock__digit
              clock__digit--s"></div>
</div>


<footer>
  <a href="https://www.linkedin.com/in/giovanni-mrqs/" target="_blank">linkedin</a>
  -
  <a href="https://github.com/web-duke" target="_blank">github</a>
  -
  <a href="https://dock.io?r=dukeweb:aaaat3HE" target="_blank">dock.io</a>
  <br>
  <span>buy me a coffee with bitcoin&nbsp;: 1CVRSirjLkKQdY2prdBta2udcoEYCKEwms</span>
</footer>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Josefin+Sans:100,300,400,600,700'); 
@import url('https://fonts.googleapis.com/css?family=Indie+Flower');

$f-primary : 'Josefin Sans', sans-serif;
$f-secondary : 'Indie Flower', cursive;
$c-front : #FFFFFF;
$c-back : #1D1F20;
$c-back-light : #383838;
$c-hilight : #FFA500;
$s-footer-height : 3rem;

%boxShadow { box-shadow: 0 0 10rem 0 #000000; }
%boxShadow--in { box-shadow: 0 0 10rem 0 #000000 inset; }

html, body { width: 100%; height: 100%; }
body { @extend %boxShadow--in; box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding-bottom: $s-footer-height; background-color: $c-back; color: $c-front; font-family: $f-primary; font-size: 10px; font-weight: 100; box-shadow: 0 0 10rem 0 #000000 inset; }
footer { position: fixed; bottom: 0; left: 0; width: 100vw; height: $s-footer-height; background-color: $c-back; text-align: center; font-family: $f-secondary; font-size: 1.2rem; letter-spacing: 0.1rem; span { font-family: $f-primary; font-size: 1rem; font-weight: 100; } }
a { text-decoration: none; color: $c-hilight; &:hover { text-decoration: underline; } }
//////////////////////////////////////////////////
//////////////////////////////////////////////////

$c-ms : $c-back-light;
$c-s : #9E4162;
$c-m : #E0B76A;
$c-h : #43627D;
$c-needle : $c-back;
$s-clock : 1.8em;
$s-border-ms : 0.5em;
$s-border-s : 1em;
$s-border-m : 1.5em;
$s-border-h : 2em;


.wd-clock {
  @extend %boxShadow;
  
  font-size: $s-clock;
  position: relative;
  overflow: hidden;
  width: 20em; height: 20em;
  border-radius: 50%;
  
  div {
    box-sizing: border-box;
  }
}

.wd-clock__circle {
  @extend %boxShadow;
  
  position: absolute;
  border-radius: 50%;
  border-style: solid;  
  transform-origin: 50% 50%;
  animation-name: tour;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  
  &:before {
    content: '';
    display: block;
    width: 0.5em;
    margin-left: auto; margin-right: auto;
    margin-bottom: 0;
    background-color: $c-needle;  
  }
  
  // wd-clock__circle--ms
  &--ms {
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-width: $s-border-ms;
    border-color: $c-ms;
    animation-duration: 1s;
    
    &:before {
      height: $s-border-ms;
      margin-top: -$s-border-ms;
    }
  }
  
  // wd-clock__circle--s
  &--s {
    top: 5%; left: 5%;
    width: 90%; height: 90%;
    border-width: $s-border-s;
    border-color: $c-s;
    animation-duration: 60s;
    
    &:before {
      height: $s-border-s;
      margin-top: -$s-border-s;
    }
  }
  
  // wd-clock__circle--m
  &--m {
    top: 12.5%; left: 12.5%;
    width: 75%; height: 75%;
    border-width: $s-border-m;
    border-color: $c-m;
    animation-duration: 3600s;
    
    &:before {
      height: $s-border-m;
      margin-top: -$s-border-m;
    }
  }
  
  // wd-clock__circle--h
  &--h {
    top: 22.5%; left: 22.5%;
    width: 55%; height: 55%;
    border-width: $s-border-h;
    border-color: $c-h;
    animation-duration: 43200s;
    
    &:before {
      height: $s-border-h;
      margin-top: -$s-border-h;
    }
  }
}

.clock__digit {
  position: absolute;
  color: $c-front;
  text-shadow: 0 0 8px $c-front;
  
  // clock__digit--s
  &--s {
    top: 57%; left: 44%;
    font-size: 1em;
  }
  
  // clock__digit--m
  &--m {
    top: 49%; left: 54%;
    font-size: 2.2em;
  }
  
  // clock__digit--h
  &--h {
    top: 38%; left: 37%;
    font-size: 3.2em;
  }
}

// ANIMATION
@-webkit-keyframes tour {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
            
          
!
            
              displayHms();
setInterval(displayHms, 1000);

var date = new Date();
document.getElementsByClassName('wd-clock__circle--ms')[0].style.animationDelay = -('0.' + date.getMilliseconds()) + 's';
document.getElementsByClassName('wd-clock__circle--s')[0].style.animationDelay = -(date.getSeconds()) + 's';
document.getElementsByClassName('wd-clock__circle--m')[0].style.animationDelay = -(date.getMinutes()*60 + date.getSeconds()) + 's';
document.getElementsByClassName('wd-clock__circle--h')[0].style.animationDelay = -((date.getHours()%12)*3600 + date.getMinutes()*60 + date.getSeconds()) + 's';


function getHms() {
  var date = new Date();  
  var hms = new Array();  
  
  hms[0] = ( (date.getHours() < 10) ? '0' : '' ) + date.getHours();
  hms[1] = ( (date.getMinutes() < 10) ? '0' : '' ) + date.getMinutes();
  hms[2] = ( (date.getSeconds() < 10) ? '0' : '' ) + date.getSeconds();
  
  return hms;
}

function displayHms() {
  var hms = getHms();  
  
  document.getElementsByClassName('clock__digit--h')[0].innerHTML = hms[0];
  document.getElementsByClassName('clock__digit--m')[0].innerHTML = hms[1];
  document.getElementsByClassName('clock__digit--s')[0].innerHTML = hms[2];
}
            
          
!
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