<!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>
*{
margin: 0;
padding: 0;
}
.wrap{
width: 300px;
height: 300px;
margin: 70px auto;
position: relative;
transform-style: preserve-3d;
transform: rotateX(10deg) rotateY(10deg) rotateZ(10deg);
animation:3s run linear infinite;
}
.wrap div{
width: 300px;
height: 300px;
text-align: center;
line-height: 300px;
font-size: 40px;
opacity: .5;
position: absolute;
top: 0;
left: 0;
transform-style: preserve-3d;
}
/* 前 */
.wrap div:nth-child(1){
background-color: rgb(47, 195, 231);
transform: translateZ(150px);
}
/* 后 */
.wrap div:nth-child(2){
background-color: rgb(47, 195, 231);
transform: translateZ(-150px) rotateY(180deg);
}
/* 上 */
.wrap div:nth-child(3){
background-color: rgb(47, 195, 231);
transform: translateY(-150px) rotateX(90deg);
}
/* 下 */
.wrap div:nth-child(4){
background-color:rgb(47, 195, 231);
transform: translateY(150px) rotateX(-90deg);
}
/* 左 */
.wrap div:nth-child(5){
background-color:rgb(47, 195, 231);
transform: translatex(-150px) rotateY(90deg);
}
/* 右 */
.wrap div:nth-child(6){
background-color:rgb(47, 195, 231);
transform: translatex(150px) rotateY(-90deg);
}
.wrap:hover{
transform: rotateX(360deg) rotateY(360deg);
}
@keyframes run{
0%{
transform: rotateX(0);
}
100%{
transform: rotateY(360deg) rotatex(360deg);
}
}
.wrap div :nth-child(7),
.wrap div :nth-child(8),
.wrap div :nth-child(9),
.wrap div :nth-child(10),
.wrap div :nth-child(11),
.wrap div :nth-child(12){
width: 100px;
height: 100px;
background-color: #000;
box-shadow: 0 0 8px 8px rgb(255,255,0);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
</style>
</head>
<body>
<div class="wrap">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>