JSFiddle - React, Tailwind, and code Playground
HTML
<div class="clock">
<div class="clock-face">
<div class="hour-hand"></div>
<div class="min-hand"></div>
<div class="second-hand"></div>
</div>
</div>
CSS
html {
background: #018DED url(https://unsplash.it/1500/1000?image=881&blur=5);
background-size: cover;
font-family: 'helvetica neue';
text-align: center;
font-size: 10px;
}
body {
margin: 0;
font-size: 2rem;
display: flex;
flex: 1;
min-height: 100vh;
align-items: center;
}
.second-hand{
width: 50%;
height: 6px;
background: black;
position: absolute;
top: 50%;
transform-origin:100% ;
border-radius: 20px;
transition: all 0.5s;
transform: rotate(90deg);
}
JavaScript
const secondHand = document.querySelector('.second-hand');
function setDate() {
secondHand.style.transform = `rotate(${6 * new Date().getSeconds()}deg)`;
}
setInterval(setDate, 1000);