<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body{
background-color: cadetblue;
}
.box {
position: relative;
width: 300px;
height: 200px;
margin: 160px auto;
perspective: 25000px;
transform-style: preserve-3d;
animation: rotate 10s linear infinite;
background-image: url(https://img2.baidu.com/it/u=2161071795,3577630275&fm=26&fmt=auto);
background-size: 100% 100%;
}
.box:hover {
animation-play-state: paused;
}
.img {
position: absolute;
left: 0;
top: 0;
width: 300px;
height: 200px;
background: url('./tiger.jpg');
}
.box .img:nth-child(1) {
transform: rotateY(0) translateZ(300px);
background-color: darkorchid;
}
.box .img:nth-child(2) {
transform: rotateY(60deg) translateZ(300px);
background-color: darkgoldenrod;
}
.box .img:nth-child(3) {
transform: rotateY(120deg) translateZ(300px);
background-color: salmon;
}
.box .img:nth-child(4) {
transform: rotateY(180deg) translateZ(300px);
background-color: blue;
}
.box .img:nth-child(5) {
transform: rotateY(240deg) translateZ(300px);
background-color: rosybrown;
}
.box .img:nth-child(6) {
transform: rotateY(300deg) translateZ(300px);
background-color: burlywood;
}
@keyframes rotate {
0% {
transform: rotateY(0);
}
100% {
transform: rotateY(360deg);
}
}
</style>
</head>
<body>
<div class="box">
<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg2.baidu.com%2Fit%2Fu%3D203943576%2C2914045910%26fm%3D253%26app%3D120%26f%3DJPEG%3Fw%3D1200%26h%3D578&refer=http%3A%2F%2Fimg2.baidu.com&app=2002&size=w300&q=a80&n=0&g=0n&fmt=jpeg?sec=1645232285&t=aad1cbeda94024f65965d757f88a3e16" alt="" class="img">
<img src="https://img1.baidu.com/it/u=2344258091,2248795866&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313" alt="" class="img">
<img src="https://img0.baidu.com/it/u=4142007859,2009814155&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=352" alt="" class="img">
<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.baidu.com%2Fit%2Fu%3D1207938889%2C442335491%26fm%3D253%26app%3D120%26f%3DPNG%3Fw%3D800%26h%3D800&refer=http%3A%2F%2Fimg1.baidu.com&app=2002&size=w300&q=a80&n=0&g=0n&fmt=jpeg?sec=1645231810&t=cfc9cded108f1ea59e7e1fc4485007d3" alt="" class="img">
<img src="https://img1.baidu.com/it/u=2344258091,2248795866&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313" alt="" class="img">
<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.baidu.com%2Fit%2Fu%3D173306754%2C3418888243%26fm%3D253%26app%3D120%26f%3DJPEG%3Fw%3D1131%26h%3D800&refer=http%3A%2F%2Fimg1.baidu.com&app=2002&size=w300&q=a80&n=0&g=0n&fmt=jpeg?sec=1645231810&t=844b075a5307d34e1f40e1aac19ec28a" alt="" class="img">
</div>
</body>
</html>
重点属性:
perspective
transform-style
animation
animation-play-state
transform: rotateY(0) translateZ(300px);