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

              
                <div class="ringbox">
  
<ul class="ring">
  <li>½</li>
  <li>¼</li>
  <li>⅛</li>
  <li>1/16</li>
  <li>1/32</li>
  <li>1/64</li>
  <li>2<sup>-7</sup></li>
  <li>2<sup>-8</sup></li>
  <li>2<sup>-9</sup></li>
  <li>2<sup>-10</sup></li>
  <li>2<sup>-11</sup></li>
  <li>2<sup>-12</sup></li>
  <li>2<sup>-13</sup></li>
  <li>2<sup>-14</sup></li>
  <li>2<sup>-15</sup></li>
  <li>2<sup>-16</sup></li>
</ul>
  <p id="binaryValue" class="binaryValue">1010101010101010</p>
</div>
<div class="content">
<h1>Pure Binary Flower Clock</h1>
<p>Each petal represents a fraction of a day. The largest represents a ½ day (2<sup>-1</sup>), followed counter-clockwise by ¼, ⅛<sup>th</sup> and so on. Each <em>tick</em> of the clock represents 2<sup>-16th</sup> of one day (about 1.318 seconds).</p>
<p>The Flower spins at exactly 2<sup>-10</sup> of a day. One rotation is about 84 seconds (84,375ms). This is the smallest segment of time that can be represented by whole decimal millisenconds.</p>
  </div>
              
            
!

CSS

              
                body {background: black; color: white; width: 80%; margin: 0 auto;}
@keyframes spin {
    from {transform:rotate(0deg);}
    to {transform:rotate(360deg);}
}

// For best results, choose 100% saturated colors and ~33% Light.
$magenta : hsl(320,100%,33%);
$green: hsl(128,100%,33%);
$blue: hsl(192,100%,33%);
$highlight : $magenta;
.content { 
  margin-top: 512px; 
}
h1, h2, ,h3 ,h4 ,h5 ,h6 {
  color: $highlight;
}
.ringbox {
  width: 160px;
  transform: rotate(-12.5deg);
  top: 125px;
  animation: spin 84375ms infinite linear;
  transform-origin: 50% 50%;
  position: relative;
  margin: 0 auto;

}
.ring {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  height: 23px;  
}
.binaryValue {
  border-radius: 20px/15px;
  padding: 10px 0;
  text-align: center;
  background: white;
  font-size: 1em;
  color: $highlight;
  border: 3px solid rgba($highlight, .25);
  margin-left: -10px; // ick magic number
}
li {
  border-radius: 100% 100% 50% 50% / 100% 100% ;
  box-sizing: border-box;
  position: absolute;
  background: white;
  padding: 10% 2%;
  width: 50px;
  font-size: .8em;
  text-align: center;
  height: 80px;
  border: 2px solid black;
  transform-origin: 50% 180px;
  left: 50px;
  top: -120px;
  transform: rotate(0deg);
  transition: all 1.3s ease-in-out; 
  border: 4px solid rgba(255,255,255,.5);
  color: $highlight;
  &.on {
    // least active (90m – 12h)
    background: desaturate($highlight,100%);
    color: white;
    padding-top: 25%;
    &:nth-child(n+5){
      background-color: desaturate($highlight, 55%);
    }
    &:nth-child(n+9){
      background-color: desaturate($highlight,40%);
    }
    &:nth-child(n+13){
      background-color: $highlight;
    }

  }

  &:nth-child(1){
    transform: rotate(22.5deg);
  }
  &:nth-child(2){
    transform: rotate(45deg);
  }
  &:nth-child(3){
    transform: rotate(67.5deg);
  }
  &:nth-child(4){
    transform: rotate(90deg);
  }
  &:nth-child(5){
    transform: rotate(112.5deg);
  }
  &:nth-child(6){
    transform: rotate(135deg);
  }
  &:nth-child(7){
    transform: rotate(157.5deg);
  }
  &:nth-child(8){
    transform: rotate(180deg);
  }
  &:nth-child(9){
    transform: rotate(202.5deg);
  }
  &:nth-child(10){
    transform: rotate(225deg);
  }
  &:nth-child(11){
    transform: rotate(247.5deg);
  }
  &:nth-child(12){
    transform: rotate(270deg);
  }
  &:nth-child(13){
    transform: rotate(292.5deg);
  }
  &:nth-child(14){
    transform: rotate(315deg);
  }
  &:nth-child(15){
    transform: rotate(337.5deg);
  }
  &:nth-child(16){
    transform: rotate(360deg);
  }
}
.info {
  float: left; 
  color: white;
  
}
              
            
!

JS

              
                function binaryize() {
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    var milli = now.getMilliseconds();
    var fract = hours / 24 + minutes / 1440 + seconds / 86400 + milli / 86400000;
	  var j = 1;
	  var binaryValue = '';
    with (Math) {
        for (i = 16; i >= 1; i--) {
          j = floor(2 * fract);
					binaryValue += j;
            if (j > 0) {
                jQuery('li:nth-last-child(' + i + ')')
									.addClass('on')
									.removeClass('off');
            } else {
                $('li:nth-last-child(' + i + ')').addClass('off').removeClass('on');
            }
            fract = eval(2 * fract - j);
        }
			  document.getElementById("binaryValue").innerText = binaryValue;
    }
    setTimeout('binaryize()', 82);
}

$(document).ready(function () {
  binaryize();
});
              
            
!
999px

Console