Clock Animation
HTML CODE:-
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <div class="container"> <span class="dot"></span> <span class="clock hour"></span> <span class="clock min"></span> <span class="clock sec"></span> </div> </body> </html> |
CSS CODE:-
body{ padding: 0px; margin: 0px; display: flex; align-items: center; justify-content: center; min-height: 100vh; background: white; } .container{ position: relative; width: 300px; height: 300px; border-radius: 50%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; } .container::after,.container::before, .dot{ content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); border-radius: 50%; } .container::before{ width: 95%; height: 95%; box-shadow:inset rgba(0, 0, 0, 0.35) 0px 5px 15px; } .container::after{ width: 50%; height: 50%; box-shadow:inset rgba(0, 0, 0, 0.35) 0px 5px 15px; } .dot{ z-index: 3; width: 15px; height: 15px; background:black; } .clock{ position: absolute; top: 50%; left: 50%; transform: translate(-50%,-100%); z-index: 2; border-radius: 5px; width: 6px; transform-origin: bottom; } .hour{ height: 20%; background:red; animation: animate 216000s steps(60) infinite; } .min{ height: 30%; background:green; animation: animate 3600s steps(60) infinite; } .sec{ height: 40%; background: blue; animation: animate 60s steps(60) infinite; } @keyframes animate{ from{ transform: translate(-50%,-100%) rotate(0deg); } to{ transform: translate(-50%,-100%) rotate(360deg); } } |