<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <title>Document</title> <style> body { transition: all 0.4s; perspective: 1000px; } .father { width: 300px; height: 200px; background: url("images/1.jpg") no-repeat; position: relative; margin: 200px auto; transform-style: preserve-3d; /*transition: all 5s linear;*/ animation: go 3s linear 0s infinite; } .father .son { width: 100%; height: 100%; background: url("images/2.jpg") no-repeat; background-size: cover; position: absolute; top: 0; left: 0; } .father .son:nth-child(1) { transform: rotateY(0deg) translateZ(300px); } .father .son:nth-child(2) { transform: rotateY(60deg) translateZ(300px); } .father .son:nth-child(3) { transform: rotateY(120deg) translateZ(300px); } .father .son:nth-child(4) { transform: rotateY(180deg) translateZ(300px); } .father .son:nth-child(5) { transform: rotateY(240deg) translateZ(300px); } .father .son:nth-child(6) { transform: rotateY(300deg) translateZ(300px); } /*.father:hover { transform: rotateY(360deg); }*/ @keyframes go { 0% { transform: rotateY(60deg); } 25% { transform: rotateY(120deg); } 50% { transform: rotateY(180deg); } 75% { transform: rotateY(240deg); } 100% { transform: rotateY(300deg); } } .father:hover { animation-play-state: paused; } </style> </head> <body> <div class="father"> <div class="son"></div> <div class="son"></div> <div class="son"></div> <div class="son"></div> <div class="son"></div> <div class="son"></div> </div> </body> </html>
运行结果: