<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<div class="logo">
  <a href="https://codeorum.com/" class="codeorum"><img alt="codeorum" src="https://codeorum.com/images/codeorum-logo-dark.svg"></a>
  <a href="https://zovko.pro/" class="mirko-zovko"><img alt="mirko-zovko" src="https://codeorum.com/images/zovko-logo-dark.svg"></a>
</div>

<div class="container">

  <div class="col">
    <h1> Analog clock dark </h1>

    <!-- clock container -->
    <div class="clock dark">
      <div class="dot"></div>  <!-- clock dot, esthetic only -->
      <div class="sec animate"></div> <!-- clock second -->
      <div class="min animate"></div> <!-- clock minute -->
      <div class="hour animate"></div> <!-- clock hour -->
    </div>

  </div>

  <div class="col">
    <h1> Analog clock white </h1>

    <div class="clock white">
      <div class="dot"></div>
      <div class="sec animate"></div>
      <div class="min animate"></div>
      <div class="hour animate"></div>
    </div>

  </div>

</div>
body{
    margin: 0;
    padding: 0;
    background: #FFC371;
    background: linear-gradient(to right, #9cecfb 50%, #262626 50%);
    font-family: 'Quicksand', sans-serif;
    color: #262626;
}
*{
    box-sizing: border-box;
}
.logo {
    position: fixed;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    left: 10px;
    top: 10px;
    flex-direction: row;
    z-index: 1000;
    
    a {
        display: block;
        height: 30px;
        width: auto;
        cursor: pointer;
        margin-right: 10px;
        img {
            height: 100%;
            width: auto;
        }
    }
  }

.container{
    display: flex;
    flex-direction: row;
    width: 100%;
    margin: 0 auto;
    padding: 50px 10px 100px 10px;
    h1{
        text-align: center;
        margin-bottom: 30px;
        font-weight: 500;
        margin-bottom: 100px;
    }
    h2{
        font-weight: 500;
    }
    .col{
        width: 50%;
        height: auto;
        display: flex;
        position: relative;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        padding: 20px;
        &:nth-child(1){
            color: #262626;
        }
        &:nth-child(2){
            color: #eee;
        }
    }
}

// clock container
.clock{
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    
    // clock dot
    .dot{
        background-color: #262626;
        width: 10px;
        height: 10px;
        border-radius: 50%;
    }

    // clock handles, common attributes
    .hour, .min, .sec{
        position: absolute;
        background-color: #262626;
        transform-origin: 50% 100%;
        border-radius: 2px;
        &.animate{
            transition: all 0.6s ease-in-out;
        }
    }

    // hour handle position and size
    .hour{
        width: 5px;
        height: 35%;
        top: 15%;
    }

    // minute handle position and size
    .min{
        width: 3px;
        height: 40%;
        top: 10%;
    }

    // second handle position and size
    .sec{
        width: 1px;
        height: 45%;
        top: 5%;
    }

    // style for dark clock
    &.dark{
        border: 2px solid #262626;
        .dot{
            background-color: #262626;
        }
        .hour, .min, .sec{
            background-color: #262626;
        }
    }

    // style for white clock
    &.white{
        border: 2px solid #eee;
        .dot{
            background-color: #eee;
        }
        .hour, .min, .sec{
            background-color: #eee;
        }
    }

    
}
View Compiled
// Clock function
function initAnalogClock(elem){

    // Getting all handle elments
    var hourHand = document.querySelector( elem +' .hour');
    var minuteHand = document.querySelector( elem +' .min');
    var secondHand = document.querySelector( elem +' .sec');

    function runClock(){
        // Getting current time
        var currentTime = new Date(); 
    
        // Getting hour handle degree based on decimal hour value calculated 
        // from current hour and curent minutes
        var hoursDegree = (currentTime.getHours()+ currentTime.getMinutes()/60) * 30 ; // 360/12
       
        //Getting minute handle degree  
        var minutesDegree = currentTime.getMinutes() * 6; // 360/60
        //Getting second handle degree  
        var secondsDegree = currentTime.getSeconds() * 6; // 360/60
    
        // Addint rotate attributes to handles
        hourHand.style.transform = "rotate("+hoursDegree+"deg)";
        minuteHand.style.transform = "rotate("+minutesDegree+"deg)";
        secondHand.style.transform = "rotate("+secondsDegree+"deg)";
    }

    // Starting runClock function
    runClock();

    // Removing animate class from handles after animation is finished
    setTimeout(function(){                 
        hourHand.classList.remove("animate");
        minuteHand.classList.remove("animate");
        secondHand.classList.remove("animate");
    }, 600); 

    // Setting clock interval for every second
    setInterval(runClock, 1000);


}

// Start clock function
initAnalogClock(".clock.white");
initAnalogClock(".clock.dark");
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.