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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <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>
            
          
!
            
              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;
  
}
            
          
!
            
              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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console