<div class="clock">
<div class="dial"></div>
<div class="pendulum"></div>
</div>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
height: 100vh;
background: lightblue;
}
.dial {
width: 100px;
height: 100px;
margin: 0 auto;
background: pink;
border-radius: 50%;
border: 8px solid #fff;
}
.pendulum {
width: 10px;
height: 150px;
background: #fff;
margin: 0 auto;
position: relative;
top: -4px;
transform-origin: center top;
animation: swing 2s infinite linear;
}
.pendulum::before {
content: '';
display: box;
width: 30px;
height: 30px;
background: pink;
border-radius: 50%;
position: absolute;
bottom: 0;
left: 50%;
transform: translate(-50%, 50%);
border: 4px solid #fff;
}
@keyframes swing {
0% {
transform: rotate(45deg)
}
25% {
transform: rotate(0)
}
50% {
transform: rotate(-45deg)
}
75% {
transform: rotate(0)
}
100% {
transform: rotate(45deg)
}
}