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 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.

Quick-add: + add another resource

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.

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.

            
              <html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Watch</title>
  </head>
  <body>
    
    <div class="container"> 
      <div class="row"> 
          <div class="col-md-6">  
            <div class="well">
              <h1 class="text-centered">Multimedia Watch Development</h1>
              <sup>Pure CSS, HTML5 & JS</sup>
              <h3>Controls</h3>
              <ul class="list-group">
                <li class="list-group-item">Click Top Button (Small Round Button) to view to controls for minutes.</li>
                <li class="list-group-item">Once you set the time, double click the same button or double click anywhere on watch screen in order to get rid time of controls.</li>
              </ul>
              <h3>Change Face</h3>
              <ul class="list-group">
                <li class="list-group-item">Click on the bottom button on the side view in order to switch to different watch face.</li>
              </ul>
            </div>
          </div>
          <div class="col-md-6">
            <div class='clock'>
    <div class="strap topStrap">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
    <!-- clockNumbers -->
    
    <!-- Polar Time -->
    <canvas class="polarWatch" id="cvs" width="50" height="50"></canvas>
    <!-- Polar Time End -->
    <!--  clockNumbers END-->
    <div class="digitalTime" id='time'></div>
    <i class="fa fa-chevron-circle-up hourControls" id="incrementMin" onclick="incrementMin()"></i>
    <i class="fa fa-chevron-circle-down hourControls" id="decrementMin"  onclick="decrementMin()"></i>
    <div class="today" id="today">
      <div class="day"></div>
      <div class="date"></div>
      <div class="month"></div>
    </div>
    <div class="handleContainer">
      <div class='second'><!-- second handle--></div>
      <div class='hour'><!-- hour handle--></div>
      <div class='minute'><!-- minute handle--> </div>
    </div>
    <!-- PlanView Controls -->
    <div class="controls">
      <div class="roundBtn"></div>
      <div class="longBtn"></div>
    </div>
    <!-- PlanView Controls Ends -->
    <div class="clockSideView">
      <div class="sideControls">
        <div class="roundBtnSide">
          <div title="Change Time" id="setTime" class="roundBtnSideInner"></div>
        </div>
        <div class="longBtnSide" id="changeFace"></div>
      </div>
    </div>
    <div class="strap bottomStrap">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  <!-- /Planview Clock END -->
  
          </div>
      </div>
    </div>
  <!-- Planview Clock -->
 
</body>
</html>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Oswald:400,700,300);

.clock {
width: 194px;
height: 221px;
position: absolute;
top: 48%;
left: 42%;
margin-left: -80px;
margin-top: 120px;
background: #454545;
display: none;
-webkit-border-radius: 45px;
-moz-border-radius: 45px;
-ms-border-radius: 45px;
-o-border-radius: 45px;
border-radius: 45px;
-webkit-box-shadow: 0 3px 1px #dddddd;
-moz-box-shadow: 0 3px 1px #dddddd;
box-shadow: 0 3px 1px #bcbcbc;
-webkit-backface-visibility: hidden;
border:5px solid #555;
}
/*.clock:after {
content: "";
width: 4%;
height: 4%;
background: #aaa;
position: absolute;
top: 50%;
left: 50%;
margin: -2% 0 0 -2%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: 0 1px 1px #444444, inset 0 1px 1px white;
-moz-box-shadow: 0 1px 1px #444444, inset 0 1px 1px white;
box-shadow: 0 1px 1px #444444, inset 0 1px 1px white;
}*/

/*Toggle Class Styles*/
.face2
{
background: rgb(4, 119, 175);
}
div.face2-handleCont
{
width: 100%; 
height: 197px;
top:-2%;
left: 0%;
}
div.face2-digital
{
top: 66%;
left:26%;
width: 90px;
font-size: 27px;
}

canvas#cvs
{

}
.face-2polarWatch
{
display: none;
}
.polarWatch
{
position: absolute;
left:18%;
top: 60%;
width: 45px;
height: 45px;
}


/*Hour and Min Control Styles*/
i#incrementMin
{
color: #fff;
position: absolute;
z-index: 99;
top: 7%;
left:60%;
font-size: 25px;
display: none;
}
i#decrementMin
{
color: #fff;
position: absolute;
z-index: 99;
top: 45%;
left:60%;
font-size: 25px;
display: none;
}
.digitalTime:hover
{
cursor: pointer;
}
.hourControls:hover
{
cursor: pointer;
opacity: .8;
}
.strap {
width: 150px;
height: 130px;
position: absolute;
margin: auto;
background: linear-gradient(to bottom, rgba(239,239,239,1) 36%,rgba(132,132,132,1) 100%);
border-radius: 28px;
z-index: -1;
box-shadow: inset 0px 0px 20px 4px rgba(50, 50, 50, 0.75);
}
.strap:before {
content: "";
display: block;
width: 20px;
height: 80%;
background: #fff;
-webkit-transform: rotate(-4deg);
position: absolute;
right: -10px;
border-bottom-left-radius: 20px;
}
.strap:after {
content: "";
display: block;
width: 20px;
height: 80%;
background: #fff;
-webkit-transform: rotate(4deg);
-moz-transform: rotate(4deg);
transform: rotate(4deg);
position: absolute;
left: -10px;
border-bottom-right-radius: 20px;
}
.strap span {
display: block;
position: absolute;
left: 0; right: 0;
margin: auto;
height: 10px;
border-top: 1px solid #666;
border-radius: 10px;
}
.strap span:nth-child(1) {
top: 20px;
width: 85%;
}
.strap span:nth-child(2) {
top: 40px;
width: 86%;
}
.strap span:nth-child(3) {
top: 60px;
width: 88%;
}
.strap span:nth-child(4) {
top: 80px;
width: 90%;
}
.bottomStrap {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
transform: rotate(180deg);
bottom: -107px; left: 0; right: 0;
}
.topStrap {
top: -104px; left: 0; right: 0;
}
.face {
width: 168px;
height: 188px;
border: 1px solid;
border-radius: 22px;
background: #000;
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
margin: auto;
overflow: hidden;
}

.second, .minute, .hour {
position: absolute;
top: 50%;
-webkit-transform: rotate(-90deg);
}
.second:after, .minute:after, .hour:after {
content: "";
width: 50%;
height: 100%;
background: #f3f3f3;
position: absolute;
left: 50%;
top: 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
}
.handleContainer
{
overflow: auto;
position: absolute;
width: 71px; 
height: 69px;
top:55%;
left: 52%;
}
.second {
height: 1px;
margin-top: -1px;
width: 71%;
left: 15%;
}
.second:after {
background: #ff8400;
}

.minute {
height: 3px;
margin-top: -2px;
width: 76%;
left: 12%;
}

.hour {
height: 5px;
margin-top: -1px;
width: 60%;
left: 20%;
}
/*controls styles*/
div.roundBtn
{
width: 12px;
height: 29px;
position: absolute;
top:21%;
left:101.2%;
border: 2px solid #555;
border-left: none;
background: #e8e8e8;
border-radius: 7px;
}
div.longBtn
{
width: 11px;
height: 53px;
position: absolute;
top:50%;
left:101.2%;
border: 2px solid #555;
border-left: none;
border-radius: 11px;
background: #e8e8e8;

}
/*side view controls*/
div.clockSideView
{
position: absolute;
top: 0%;
left: 129%;
width:50px;
height: 214px;
border: 4px solid #555;
border-radius: 45px;
background-color: #e8e8e8;

}
.roundBtnSide
{
width: 28px;
height: 30px;
position: absolute;
top: 19%;
left: 17%;
border:2px solid #555;
border-radius: 30px;
}
div.roundBtnSideInner
{
width:23px;
height: 23px;
border:1px solid #555;
border-radius: 25px;
top:7%;
left: 5%;
position: absolute;
box-shadow: 0px 1px 0px 0px;
}
div.roundBtnSideInner:active
{
-webkit-transform: translate(0px, 1px);
-moz-transform: translate(0px, 1px);
box-shadow: 0px 1px 0px 0px #e8e8e8;
}
div.longBtnSide
{
border: 2px solid #555;
position: absolute;
width: 18px;
height: 57px;
top:49%;
left: 27.5%;
border-radius: 25px;
/*-moz-box-shadow:    inset 0 0 10px #e8e8e8;
-webkit-box-shadow: inset 0 0 10px #e8e8e8;
box-shadow:         inset 0 0 10px #e8e8e8;*/
}
div.longBtnSide:active
{
-moz-box-shadow:    inset 0 0 5px #716e6f;
-webkit-box-shadow: inset 0 0 5px #716e6f;
box-shadow:         inset 0 0 5px #716e6f;
}

/**/
.digitalTime {
width: 100%;
font-size: 62px;
font-family: 'Oswald', sans-serif;
text-align: right;
color:#ff8400;
position: absolute;
top: 10%;
left:0%;
font-weight: 300;
-webkit-font-smoothing: antialiased;
text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
text-align: center;
}

/*Date*/
.today
{
position: absolute;
width: 100%;
font-size: 12px;
font-family: 'Oswald', sans-serif;
font-weight: 600;
text-align: right;
color:#ff8400;
position: absolute;
top: 85%;
left:0%;
font-weight: 400;
-webkit-font-smoothing: antialiased;
text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
text-align: center;
}
.today div
{
display: inline-block;
}

            
          
!
            
              var $time = new Date();
var $month = $time.getMonth();
var $date = $time.getDate();
var $day = $time.getDay();

var $days = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

var $months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

$('.month').html($months[$month]);
$('.date').html($date);
$('.day').html($days[$day]);

/*Watch Engine Starts Here*/
var incrementMinClicked = false;
var decrementMinClicked = false;
var decrementHourClicked = false;
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();

// if(minutes<10) minutes = '0'+minutes;

var timeIsClicked = 0;

window.onload = function() {
  setInterval(updateClock, 1000);
}

function updateClock() {

  var currentTime = new Date();
  var hours = currentTime.getHours();
  var minutes = currentTime.getMinutes();
  var seconds = currentTime.getSeconds();

  if (incrementMinClicked) {
    timeIsClicked++;
    min = min + 6;
    incrementMinClicked = false
  }

  if (decrementMinClicked) {
    timeIsClicked--;
    min = min - 6;
    decrementMinClicked = false
  }

  var increaseMin = calculateIncMin(timeIsClicked);
  var increaseHour = calculateIncHour(timeIsClicked);

  minutes += increaseMin;

  if (minutes >= 60) {
    minutes -= 60;
    hours += 1;
  }

  if (minutes < 10) minutes = '0' + minutes;
  hours += increaseHour;

  if (hours >= 24) {
    hours - 24;
  };

  $('.clock').show();

  function calculateIncMin(min) {
    return min % 60;
  }

  function calculateIncHour(min) {
    return ~~(min / 60);
  }

  // var gtmStatus = 'AM';
  // if (hours > 12){
  //   hours = hours-12;
  //   gtmStatus = 'PM';
  // }

  var degree_seconds = -90 + (seconds * 6);
  var degree_minute = -90 + (minutes * 6);
  var degree_hour = -90 + (hours * 30);

  degree_hour = degree_hour + (0.5 * minutes);

  // $('#time').html(hours + ':' + minutes + ':' + seconds + ' ' + gtmStatus);
  $('#time').html(hours + ':' + minutes);
  $('.hour').css('-webkit-transform', 'rotate(' + degree_hour + 'deg)');
  $('.hour').css('-moz-transform', 'rotate(' + degree_hour + 'deg)');
  $('.hour').css('-ms-transform', 'rotate(' + degree_hour + 'deg)');

  $('.minute').css('-webkit-transform', 'rotate(' + degree_minute + 'deg)');
  $('.minute').css('-moz-transform', 'rotate(' + degree_minute + 'deg)');
  $('.minute').css('-ms-transform', 'rotate(' + degree_minute + 'deg)');

  $('.second').css('-webkit-transform', 'rotate(' + degree_seconds + 'deg)');
  $('.second').css('-moz-transform', 'rotate(' + degree_seconds + 'deg)');
  $('.second').css('-ms-transform', 'rotate(' + degree_seconds + 'deg)');
}

function incrementMin() {
  incrementMinClicked = true;
}

function decrementMin() {
  decrementMinClicked = true;
}

var cvs = document.getElementById("cvs");
var ctx = cvs.getContext("2d");

var sec = null;
var min = null;
var hrs = null;

var hourColors = {
  s: '#ff8400',
  m: '#fff',
  h: '#fff'
}

var colorSet = hourColors;

function degToPi(d) {
  return ((d / 360) * 2) - 0.5;
}

function drawSeconds(startAngle, endAngle) {
  ctx.strokeStyle = colorSet.s;
  ctx.lineWidth = 2;
  drawArc((cvs.width / 2) - 15, startAngle, endAngle);
}

function drawMinutes(startAngle, endAngle) {
  ctx.strokeStyle = colorSet.m;
  ctx.lineWidth = 4;
  drawArc((cvs.width / 2) - 10, startAngle, endAngle);
}

function drawHours(startAngle, endAngle) {
  ctx.strokeStyle = colorSet.h;
  ctx.lineWidth = 6;
  drawArc((cvs.width / 2) - 3, startAngle, endAngle);
}

function drawArc(radius, startAngle, endAngle) {
  ctx.beginPath();
  ctx.arc(cvs.width / 2, cvs.height / 2, radius,
    degToPi(startAngle) * Math.PI,
    degToPi(endAngle) * Math.PI);
  ctx.stroke();
}

function clear() {
  ctx.clearRect(0, 0, cvs.width, cvs.height);
}

function showTime() {
  var now = new Date();
  var m = now.getMinutes();
  if (m < 10) m = '0' + m;
  var t = now.getHours() + ':' + m;
  $('#time2').html(t);
}

function draw() {
  clear();
  drawSeconds(0, sec);
  drawMinutes(0, min);
  drawHours(0, hrs);
  showTime();
}

function increment() {
  sec += 6;
  if (sec == 360) {
    min += 6;
    if (min == 360) {
      hrs += 30;
      if (hrs > 360) hrs = 30;
    } else if (min > 360) min = 6;
  } else if (sec > 360) sec = 6;
}

function init() {
  var now = new Date();
  sec = now.getSeconds() * 6;
  min = now.getMinutes() * 6;
  hrs = now.getHours() * 30;
  if (sec == 0) sec = 360;
  if (min == 0) min = 360;
  if (hrs > 360) hrs -= 360;
  else if (hrs == 0) hrs = 360;
}

init();
draw();
increment();
setInterval(function() {
  draw();
  increment();
}, 1000);
$( document ).ready(function() {
     $('#setTime').on('click', function() {
  $('.hourControls').fadeIn('slow/600/fast');
});
//double click digital time/ anywhere on the clock to remove the hour conrtrols
$("#setTime").dblclick(function() {
  $('.hourControls').fadeOut('slow/600/fast');
});
$(".clock").dblclick(function() {
  $('.hourControls').fadeOut('slow/600/fast');
});
$("#changeFace").click(function() {
  $(".clock").toggleClass("face2", 600, "easeOutQuart");
  $(".handleContainer").toggleClass("face2-handleCont", 600, "easeOutQuart");
  $(".digitalTime").toggleClass("face2-digital", 600, "easeOutQuart");
  $(".polarWatch").toggleClass("face-2polarWatch", 600, "easeOutQuart");
  $('.hourControls').fadeOut('slow/600/fast');
  $(".date").toggleClass("date-hide", 600, "easeOutQuart");
});
  
});
            
          
!
999px
Loading ..................

Console