Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- 
Coded version of a Dribbble shot by Webshocker:
  https://dribbble.com/shots/3505409-Counter
Go check it out, it looks way better with 3dsMax 
-->

<div class="timerWrap" id="cubes">
  <div class="row">
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
  </div>
  <div class="row">
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
  </div>
  <div class="row">
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
  </div>
  <div class="row">
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
  </div>
  <div class="row">
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
    <div class="cube">
      <div class="front"></div>
      <div class="top"></div>
      <div class="back"></div>
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
    </div>
  </div>
</div>

              
            
!

CSS

              
                
.timerWrap {
    background: rgba(0, 0, 0, 1);
    box-shadow: 40px 20px 110px rgba(0, 0, 0, 0.1),
        110px 110px 300px rgba(0, 0, 0, 0.4), 10px 60px 140px rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    margin: 50px;
}

.row {
    height: 106.5px;
    perspective: 900px;
    box-shadow: 0 10px 50px #000;
    .cube:nth-of-type(2) {
        position: relative;
        z-index: 1;
    }
    &:last-of-type {
        height: 100px;
    }
}

.cube {
    width: 100px;
    height: 100px;
    display: inline-block;
    transition: transform 1s;
    transform-style: preserve-3d;
    float: left;
    color: #666;
    font-size: 0.8em;
    margin-bottom: 3px;
    margin: 0.5px;
    > div {
        position: absolute;
        border: 1px solid rgba(0, 0, 0, 0.3);
        width: 100px;
        height: 100px;
        border-radius: 5px;
        box-shadow: 0 0 8px rgba(255, 255, 255, 0.3) inset;
    }
}

.front {
    transform: rotateY(0deg) translateZ(50px);
    background: linear-gradient(to bottom right, #f3d655, #d5b634);
}
.back {
    transform: rotateX(180deg) translateZ(50px);
    background: linear-gradient(to bottom right, #f3d655, #d5b634);
}
.top {
    transform: rotateX(90deg) translateZ(50px);
    background: linear-gradient(to bottom right, #171717, #111);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2) inset !important;
}
.bottom {
    transform: rotateX(-90deg) translateZ(50px);
    background: linear-gradient(to bottom right, #171717, #111);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2) inset !important;
}
.left {
    transform: rotateY(-90deg) translateZ(50px);
    background: linear-gradient(to bottom right, #f3d655, #d5b634);
}
.right {
    transform: rotateY(90deg) translateZ(50px);
    background: linear-gradient(to bottom right, #f3d655, #d5b634);
}

// ------------------ LAYOUT ------------------

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

body,
html {
    height: 100%;
}

body {
    background: #e6cb50;
    background: linear-gradient(to bottom right, #f7dc5b, #c1a015);
    display: flex;
    align-items: center;
    justify-content: center;
}


@media (max-height: 600px) { 
    .timerWrap {
        transform: scale(.8);
    }
 }
              
            
!

JS

              
                
// Cube matrix -------------------------------

var matrix = [
  [
    false, true, false,
    false, true, false,
    false, true, false,
    false, true, false,
    false, true, false
  ],
  [
    true, true, true,
    false, false, true,
    true, true, true,
    true, false, false,
    true, true, true
  ],
  [
    true, true, true,
    false, false, true,
    false, true, true,
    false, false, true,
    true, true, true
  ],
  [
    true, false, true,
    true, false, true,
    true, true, true,
    false, false, true,
    false, false, true
  ],
  [
    true, true, true,
    true, false, false,
    true, true, true,
    false, false, true,
    true, true, true
  ],
  [
    true, true, true,
    true, false, false,
    true, true, true,
    true, false, true,
    true, true, true
  ],
  [
    true, true, true,
    false, false, true,
    false, false, true,
    false, false, true,
    false, false, true
  ],
  [
    true, true, true,
    true, false, true,
    true, true, true,
    true, false, true,
    true, true, true
  ],
  [
    true, true, true,
    true, false, true,
    true, true, true,
    false, false, true,
    false, false, true
  ],
  [
    true, true, true,
    true, false, true,
    true, false, true,
    true, false, true,
    true, true, true
  ]
];

var grad = new Date(0, 0, 0, 0, 0, 0, 0);
var cube = $('#cubes');
var cube2 = $('#cubes2');

function renderDigit(container, number) {
  var children = container.children().children();
  
  var len = matrix[number].length;
  var state;
  for (var i = 0; i < len; i++) {
    state = children.eq(i).data('state') || 'off';
    if (
      (matrix[number][i] && state === 'off') ||
      (!matrix[number][i] && state === 'on')
    ) {
      rotate.call(children.eq(i));
    }
  }
}

function render() { 
  var now = new Date(),
    diff = String(grad.getTime() - now.getTime()),
    len = diff.length; 
  renderDigit(cube, Number(diff.charAt(len-4)));
  renderDigit(cube2, Number(diff.charAt(len-4)));
  requestAnimationFrame(render);
} 
 
requestAnimationFrame(render); 

// Click to flip
$('.cube').click(rotate);
 
function rotate(){
    var angle = ($(this).data('angle') + -90) || -90; 
    var state = $(this).data('state') || 'off';
    $(this).css({'transform': 'rotateX(' + angle + 'deg)'});
    $(this).data('angle', angle); 
    $(this).data('state', (state === 'on') ? 'off' : 'on');
}

              
            
!
999px

Console