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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              .sc-slideyclock
  .sc-slideyclock__column.hour#h1
    .sc-slideyclock__column__group
      - (0..1).each do |i|
        %div.sc-number #{i}
  .sc-slideyclock__column.hour#h2
    .sc-slideyclock__column__group
      - (0..9).each do |i|
        %div.sc-number #{i}
  .sc-slideyclock__column.minute#m1
    .sc-slideyclock__column__group
      - (0..5).each do |i|
        %div.sc-number #{i}
  .sc-slideyclock__column.minute#m2
    .sc-slideyclock__column__group
      - (0..9).each do |i|
        %div.sc-number #{i}
  .sc-slideyclock__column.second#s1
    .sc-slideyclock__column__group
      - (0..5).each do |i|
        %div.sc-number #{i}
  .sc-slideyclock__column.second#s2
    .sc-slideyclock__column__group
      - (0..9).each do |i|
        %div.sc-number #{i}
          
          
<div id="sc-miniclock"></div>

            
          
!
            
              html { box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; }


.sc-slideyclock{
  background:grey;
  width:600px;
  height:100px;
  margin:100px auto 0 auto;
  display:flex;
  position:relative;
  user-select:none;
  
  &:before{
    content:'';
    border:solid 5px black;
    position:absolute;
    width:100%;
    height:100%;
    top:0;
    left:0;
    z-index:10;
    pointer-events:none;
  }
  
  .sc-slideyclock__column{
    width:100px;
    height:100px;
    
    &.hour{
      .sc-number{
        background:red;
        color:white;
      }
    }
    &.minute{
      .sc-number{
        background-color:white;
      }
    }
    &.second{
      .sc-number{
        background:#444;
        color:white;
      }
    }
  }
}

.sc-number{
  width:100px;
  height:100px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:solid 1px rgba(0,0,0,.2);
}

#sc-miniclock{
  position:absolute;
  top:10px;
  left:10px;
  background:yellow;
  padding:5px;
  border:solid 1px #ccc;
}
            
          
!
            
               var gridHeight = 100;


processTheTime();


function processTheTime() {
    var today = new Date();
    var h = today.getHours();
        h = h % 12;
    var m = today.getMinutes();
    var s = today.getSeconds();
    // Hours
    var hx = String(formatTime(h));
    var h1 = Number(hx.charAt(0));
    var h2 = Number(hx.charAt(1));
    // Minutes
    var mx = String(formatTime(m));
    var m1 = Number(mx.charAt(0));
    var m2 = Number(mx.charAt(1));
    // Seconds
    var sx = String(formatTime(s));
    var s1 = Number(sx.charAt(0));
    var s2 = Number(sx.charAt(1));
    // Mini Clock
    $('#sc-miniclock').html( hx + ":" + mx + ":" + sx);
    // Sliders
    liveSliders(h1, h2, m1, m2, s1, s2);
    // Timer
    var timer = setTimeout(processTheTime, 1000);
}

// add zero in front of numbers < 10
function formatTime(i) {
    if (i < 10) {i = "0" + i};  
    return i;
}


// sliders update every second
function liveSliders(h1, h2, m1, m2, s1, s2){
  
   TweenMax.to($('.sc-slideyclock__column.hour#h1 .sc-slideyclock__column__group'), 1, { y:-(h1 * gridHeight), ease:Power3.easeOut });
   TweenMax.to($('.sc-slideyclock__column.hour#h2 .sc-slideyclock__column__group'), 1, { y:-(h2 * gridHeight), ease:Power3.easeOut });
   TweenMax.to($('.sc-slideyclock__column.minute#m1 .sc-slideyclock__column__group'), 1, { y:- (m1 * gridHeight), ease:Power3.easeOut });
   TweenMax.to($('.sc-slideyclock__column.minute#m2 .sc-slideyclock__column__group'), 1, { y:-(m2 * gridHeight), ease:Power3.easeOut });
   TweenMax.to($('.sc-slideyclock__column.second#s2 .sc-slideyclock__column__group'), 1, { y:-(s2 * gridHeight), ease:Power3.easeOut });
   TweenMax.to($('.sc-slideyclock__column.second#s1 .sc-slideyclock__column__group'), 1, { y:- (s1 * gridHeight), ease:Power3.easeOut });
}

 
            
          
!
999px
Loading ..................

Console