<style>
body {
perspective: 2500px;
background-color: black;
}
.box {
position: relative;
width: 100px;
height: 100px;
margin: 350px auto;
transform-style: preserve-3d;
transition: all 6s;
animation: rot 10s linear infinite;
}
.box span {
width: 400px;
height: 400px;
}
@keyframes rot {
from {
transform: rotateY(0);
}
50% {
transform: rotateY(180deg) rotateZ(45deg);
}
to {
transform: rotateY(360deg);
}
}
.box div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .5;
}
.box span {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .5;
}
div div:nth-child(1) {
transform: rotateY(0) translateZ(50px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div div:nth-child(2) {
transform: rotateY(90deg) translateZ(50px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div div:nth-child(3) {
transform: rotateY(180deg) translateZ(50px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div div:nth-child(4) {
transform: rotateY(270deg) translateZ(50px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div div:nth-child(5) {
transform: rotateX(90deg) translateZ(50px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div div:nth-child(6) {
transform: rotateX(270deg) translateZ(50px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
/* 大盒子 */
div span:nth-child(1) {
transform: rotateY(0) translateZ(200px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div span:nth-child(2) {
transform: rotateY(90deg) translateZ(200px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div span:nth-child(3) {
transform: rotateY(180deg) translateZ(200px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div span:nth-child(4) {
transform: rotateY(270deg) translateZ(200px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
divspan:nth-child(5) {
transform: rotateX(90deg) translateZ(200px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
div span:nth-child(6) {
transform: rotateX(270deg) translateZ(200px);
background: url(./img/脸上长花的女生.jpg) no-repeat;
background-size: cover;
}
</style>
简单的html代码
<body>
<div class="box">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>