JavaScript
const clock = () => {
const d = new Date();
let hour = d.getHours();
let min = d.getMinutes();
let sec = d.getSeconds();
var hourDeg = (hour * 360 / 12) + ((min * 360 / 60) / 12) + ((sec * 360 / 60) / 720) + 90;
var minDeg = (min * 360 / 60) + ((sec * 360 / 60) / 60) + 90;
var secDeg = (sec * 360 / 60) + 90 ;
var animation = document.createElement("style");
animation.innerHTML = `@keyframes rotation-s {
0% {transform: rotate(` + secDeg + `deg)}
100% {transform: rotate(` + (secDeg + 360) + `deg)}
}
@keyframes rotation-m {
0% {transform: rotate(` + minDeg + `deg)}
100% {transform: rotate(` + (minDeg + 360) + `deg)}
}
@keyframes rotation-h {
0% {transform: rotate(` + hourDeg + `deg)}
100% {transform: rotate(` + (hourDeg + 360) + `deg)}
}`;
document.head.appendChild(animation);
};