<!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>琛哥立方体</title>
<style>
.box {
position: relative;
margin: 200px auto;
width: 200px;
height: 200px;
transform-style: preserve-3d;
transition: all 2s;
animation: zhuan 2.5s steps(1000) infinite;
}
.common {
width: 200px;
height: 200px;
position: absolute;
}
.front {
top: 0;
left: 0;
background-color: aqua;
}
.back {
top: 0;
left: 0;
background-color: greenyellow;
transform: translateZ(-200px);
}
.right {
top: 0;
right: -200px;
background-color: violet;
transform-origin: left;
transform: rotateY(90deg);
}
.left {
top: 0;
left: -200px;
background-color: tomato;
transform-origin: right;
transform: rotateY(-90deg);
}
.top {
top: -200px;
left: 0;
background-color: pink;
transform: rotateX(90deg);
transform-origin: bottom;
}
.bottom {
bottom: -200px;
left: 0;
background-color: palegreen;
transform: rotateX(-90deg);
transform-origin: top;
}
@keyframes zhuan {
from {
transform: rotateX(0) rotateY(0)
}
to {
transform: rotateX(360deg) rotateY(360deg);
}
}
</style>
</head>
<body>
<div class="box">
<div class="top common"></div>
<div class="front common"></div>
<div class="back common"></div>
<div class="right common"></div>
<div class="left common"></div>
<div class="bottom common"></div>
</div>
</body>
</html>