<div class="box swing"></div>
html,body {
display: grid;
justify-items: center;
align-content: center;
width: 100%;
height: 100%;
background-color: #eaeaea;
}
.box {
width: 100px;
height: 100px;
background-color: indianred;
}
.swing {
animation-name: swing;
animation-duration: 2s;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-fill-mode: backwards;
}
@keyframes swing {
/* These styles will be applied throughout the animation */
0%, 100% {
border-radius: 50%;
transform-origin: 0 -100px;
}
0% {
transform: rotate(77deg);
}
100% {
transform: rotate(-45deg);
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.