效果演示

html 代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rotating Eyes</title>
<style>
body { background: #a4d4e0; }
.eyes { width: 108px; height: 54px; position: absolute; top: 50%; left: 50%; margin-top: -27px; margin-left: -54px; }
.eye { position: relative; background: #0f0e0e; width: 50px; height: 50px; float: left; margin: 2px; overflow: hidden; animation: rotate 4s infinite; }
.eye::before { position: absolute; content: ""; width: 20px; height: 20px; background: #dacbe5; animation: eye 4s infinite; }
.eye::before, .eye { border-radius: 50%; -webkit-border-radius: 50%; }
@keyframes rotate { 0% { transform: rotate(0deg); } 50% { transform: rotate(0deg); } 62.5% { transform: rotate(-90deg); } 87.5% { transform: rotate(90deg); } 100% { transform: rotate(0deg); } }
@-webkit-keyframes rotate { 0% { transform: rotate(0deg); } 50% { transform: rotate(0deg); } 62.5% { transform: rotate(-90deg); } 87.5% { transform: rotate(90deg); } 100% { transform: rotate(0deg); } }
@keyframes eye { 0% { top: 15px; left: 15px; } 12.5% { top: 15px; left: 5px; } 25% { top: 15px; left: 15px; } 37.5% { top: 15px; left: 25px; } 50% { top: 15px; left: 15px; } 62.5% { top: 5px; left: 15px; } 87.5% { top: 5px; left: 15px; } 100% { top: 15px; left: 15px; } }
@-webkit-keyframes eye { 0% { top: 15px; left: 15px; } 12.5% { top: 15px; left: 5px; } 25% { top: 15px; left: 15px; } 37.5% { top: 15px; left: 25px; } 50% { top: 15px; left: 15px; } 62.5% { top: 5px; left: 15px; } 87.5% { top: 5px; left: 15px; } 100% { top: 15px; left: 15px; } }
</style>
</head>
<body>
<div class="eyes">
<div class="eye eye-left"></div>
<div class="eye eye-right"></div>
</div>
</body>
</html>