123

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              -#Where you at? (UTC)
- timeZone = -5

-#Seconds
- sec = Time.now.sec
- secRotate = sec * 6
- secFull = 360 + (sec * 6)
-#Minutes
- min = Time.now.min
- minRotate = min * 6
- minFull = 360 + (min * 6)
- minAdjustHour = ((min / 60.0) * 30)
-#Hours
- hour = Time.now.hour
-#Adjust hour based on timezone
- timeAdjust = hour + (timeZone + 1)
- if timeAdjust <= 0
  - hourAdjust = 24 + timeAdjust
- elsif timeAdjust > 24
  - hourAdjust = timeAdjust - 24
- else
  - hourAdjust = timeAdjust
- hourRotate = (hourAdjust * 30) + minAdjustHour
-#Background
- alpha = (hourAdjust / 48.0) + 0.5

:css
  body {background: rgba(#009cb8, #{alpha}); }
  .sec {animation: seconds 60s infinite linear forwards}
  @keyframes seconds {
  0% {transform:rotate(#{secRotate}deg)}
  100% {transform:rotate(#{secFull}deg)}
  }
  .min {animation: minutes 3600s infinite linear forwards}
  @keyframes minutes {
  0% {transform:rotate(#{minRotate}deg)}
  100% {transform:rotate(#{minFull}deg)}
  }
  .hour {animation: hours 36000s infinite linear forwards}
  @keyframes hours {
  0% {transform:rotate(#{hourRotate}deg)}
  100% {transform:rotate(360deg)}
  }
  
.container
  .clock
    .sec
    .min
    .hour
    %ul.numbers
      - (0...60).each do |i|
        %li
  .time #{hourAdjust}:#{min}      
            
          
!
            
              @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Josefin+Sans);

$bodyBackground: invert(tomato);
$clockBackground: #333;
$fixtures: #ebebeb;
$accent: tomato;
$font: 'Josefin Sans', sans-serif;


/* Light Scheme
$clockBackground: #eee;
$bodyBackground: invert(tomato);
$fixtures: #333;
$accent: tomato;
*/

@mixin putOnCircle( $nb-items, $circle-size, $item-size) {
  $half-item:     $item-size / 2;
  $half-parent: $circle-size / 2;
  
  position: relative;               
  width:  $circle-size;
  height: $circle-size;
  padding: 0;
  border-radius: 50%; 
  list-style: none;     
  @include box-sizing(content-box); 
  
  > * {    
    display: block;
    position: absolute;
    top:  50%; 
    left: 50%;
    width:  $item-size;
    height: $item-size;
    margin: -$half-item;
    $angle: 360 / $nb-items;
    $rot: 0;
    @for $i from 1 to $nb-items+1 {
      &:nth-of-type(#{$i}) {@include transform(rotate(#{$rot}deg) translate($half-parent) rotate(-#{$rot}deg));}
        $rot: $rot + $angle;
      }
    }
  }
  
  * {
    @include box-sizing(border-box);   
  }
  html {
    width:100%;
    height:100%;
  }
  body {
    width:100%;
    height:100%;
    @include display-box; 
    @include box-align(center);
    @include box-pack(center);
    background:$bodyBackground;
    @include transition(font-size .5s cubic-bezier(.88,.23,.3,1.25));
  }
  .container {position:relative;}
  .clock {
    position:relative;
    width:10em;
    height:10em;
    background:$clockBackground;
    border-radius:100%;
    border:0.5em solid darken($clockBackground,5%);
    display:none;
    z-index:1;
    &:before {
      content:"";
      width:0.5em;
      height:0.5em;
      border:0.2em solid $fixtures;
      background:$accent;
      position:absolute;
      border-radius:100%;
      top:4em;
      left:4em;
      color:black;
      z-index:1;
    }
    &:hover ~ .time {
      @include opacity(1);
      top:100%;
    }
  }
  .hour,.min, .sec {
    width:0.25em;
    height:10em;
    top:-0.5em;
    left:4.35em;   
    @include background-image(linear-gradient(transparent 25%, $fixtures 25%, $fixtures 50%,transparent 50%));
    position:absolute;
  }
  .sec {
    width:1px;
    @include background-image(linear-gradient(transparent 15%, $accent 15%, $accent 57%,transparent 57%));
    z-index:1;
  }
  .hour {
    @include background-image(linear-gradient(transparent 35%, $fixtures 35%, $fixtures 50%,transparent 50%));
  }
  .numbers {
    @include putOnCircle(60, 8em, 0);
    color:rgba($fixtures,0.25);
    position:absolute;
    top:0.4em;
    left:0.4em;
    li {
      border:.05em solid rgba($fixtures,0.1);
      border-radius:100%;     
      &:nth-child(5n + 1) {
        border-width:.1em;
      }
    }
  }
  .time {
    font-family:$font;
    width:100%;
    text-align:center;
    font-size:1.5em;
    @include transition(all .25s ease-in-out);
  }
  @for $i from 1 to 7 {
    @media (min-width: $i*10em) and (min-height:$i*10em) {
      body {font-size:$i*10px;}
      @if $i == 1 {
        .time {
          top:50%;
          position:absolute; 
          @include opacity(0);
        }
        .clock {display:block;}
      }
    }
  }
            
          
!
            
              // Design inspiration from Dribbble: http://dribbble.com/shots/1221456-Flat-Watch-2

// Items on Circle mixin from: http://hugogiraudel.com/2013/04/02/items-on-circle/
            
          
!
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.

Console