Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <head>
	<title>Prague Astronomical Clock</title>
	<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
  <h2 class="description">This is my version of the Prague Astronomical Clock, which shows time in old Czech hours and the signs of the Zodiac.</h2>
<ul class="clock">	
    <li id="out"></li>
    <li id="zod"></li>
    <li id="sec"></li>
    <li id="hour"></li>
    <li id="min"></li>
</ul>
    
<!--<footer>Golden Hand image on hour hand -http://commons.wikimedia.org/wiki/File:Guante_Lambayeque.JPG Fotógrafo: © Manuel González Olaechea y Franco, -http://creativecommons.org/licenses/by/3.0/deed.en;
Sun image on hour hand- http://apod.nasa.gov/apod/ap100923.html</footer>-->
	<script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
              
            
!

CSS

              
                body {
    background-color: #E1EAF0;
}

.description {
  text-align: center;
  margin-top: 50px;
}

.clock {
    position: relative;
    width: 600px;
    height: 600px;
    margin: 50px auto 0;
    background: url(http://imageshack.com/a/img841/4461/c6am.png);
    background-repeat: no-repeat;
    list-style: none;
}

#out {
    position: absolute;
    width: 640px;
    height: 640px;
    top: -19px;
    left: -22px;
    background: url(https://imageshack.com/i/n6ajj7p);
    background-repeat: no-repeat;
    z-index: 1;
}

#zod {
    position: absolute;
    width: 600px;
    height: 600px;
    top: 40px;
    left: -10px;
    background: url(http://imageshack.com/a/img834/8898/47ej.png);
    background-repeat: no-repeat;
    z-index: 2;
}

#sec, #min, #hour {
    position: absolute;
    height: 600px;
    top: 0px;
    left: 289px;
    background-repeat: no-repeat;
}

#sec {
  width: 20px;
  background: url(http://imageshack.com/a/img842/8844/wq6j.png);
  z-index: 5;
}
   
#min {
  width: 20px;
  background: url(http://imageshack.com/a/img841/6458/4bwa.png);
  z-index: 4;
}
   
#hour {
  top: 5px;
  width: 60px;
  left: 270px;
  background: url(http://imageshack.com/a/img836/866/87nn.png);
  z-index: 3;
}
              
            
!

JS

              
                var hours;
var hourDeg;
var totaldays;
var sunDeg;
var months;
var days;
var startDeg;
var seconds;
var mins;

//pulls the time locally and sets the images in motion

$(function() {
 
      setInterval( function() {
      seconds = new Date().getSeconds();
      var sectick = "rotate(" + seconds * 6 + "deg)";
      $("#sec").css({ "transform": sectick });
          
      }, 1000 );
      
      setInterval( function() {
      hours = new Date().getHours();
      astroHours();
      var hourtick = "rotate(" + hourDeg + "deg)";
      $("#hour").css({ "transform": hourtick});
          
      }, 1000 );

      setInterval( function() {
      mins = new Date().getMinutes();
      var mintick = "rotate(" + mins * 6 + "deg)";
      
      $("#min").css({ "transform" : mintick });
          
      }, 1000 );
 
      setInterval( function() {
      var month = new Date().getMonth();
      months = month + 1;
      days = new Date().getDate();
      sunset();
      zodiac();
      var daytick = "rotate(" + sunDeg + "deg)";
      
      $("#out").css({ "transform" : daytick });
          
      }, 1000 );
});


// calculates the hour of day on the astronomical clock, noon is at 0 degrees
function astroHours(){

    if (0 < hours < 12){
        hourDeg = 180 + 15*hours;
    }   
    else if (12 < hours <=24){
        hourDeg = 15*hours;
    }
}

//calculates degrees for outer ring estimating old Czech time  
function sunset(){
   
    totaldays = months * 30.5 + days; 
    if (totaldays > 349 && totaldays <= 365) {
        sunDeg = 60 + ((totaldays - 349)*.42);
    }        
    else if (totaldays >= 0 && totaldays < 206){
        sunDeg = 60 + (totaldays *.42);
    }   
    else if (totaldays >= 206 && totaldays <= 349) {
        sunDeg = 139 - (totaldays *.42);
    }
}

//moves the zodiac dial
function zodiac(){
    if (totaldays >= 21 && totaldays < 51) {
        startDeg = 300;
        //aquarius Jan 21
    }
    else if (totaldays >= 51 && totaldays < 81) {
        startDeg = 330;
        //pisces Feb 21
    }
    else if (totaldays >= 81 && totaldays < 111) { 
        startDeg = 0;
        //ares March 21
    }
    else if (totaldays >= 111 && totaldays < 141) {
        startDeg = 30;
        //taurus April 20
     }
    else if (totaldays >= 141 && totaldays < 171) {
        startDeg = 60;
        //gemini May 21
     }
    else if (totaldays >= 171 && totaldays < 201) {
        startDeg = 90;
     }
    else if (totaldays >= 201 && totaldays < 231) {
        startDeg = 120;
     }
    else if (totaldays >= 231 && totaldays < 261) {
        startDeg = 150;
     }
    else if (totaldays >= 261 && totaldays < 291) {
        startDeg = 180;
     }
    else if (totaldays >= 291 && totaldays < 321) {
        startDeg = 210;
     }
    else if (totaldays >= 321 && totaldays < 351) {
        startDeg = 240;
     }
    else if (totaldays >= 351 && totaldays < 21){
        startDeg = 270;
     }
var endDeg = (startDeg + hourDeg) - 30;

     var zodtick = "rotate(" + endDeg + "deg)";
      
      $("#zod").css({ "transform" : zodtick });
}


              
            
!
999px

Console