JSFiddle - React, Tailwind, and code Playground
animation on css
by hronic
HTML
<div class="creature"></div>
CSS
.creature {
width: 200px;
height: 200px;
border-radius: 50%;
background: #3ac;
position: relative;
}
.creature::before, .creature::after {
content: '';
position: absolute;
width: 30px;
height: 20px;
border-radius: 50%;
background: #000;
top: 40px;
animation: eye 1s ease-in-out infinite;
-webkit-animation: eye 3s ease-in-out infinite;
}
.creature::before { left: 55px; }
.creature::after { right: 55px; }
@keyframes eye {
90% { transform: none; }
95% { transform: scaleY(0.1); }
}
@-webkit-keyframes eye {
90% { transform: none; }
95% { transform: scaleY(0.1); }
}