<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet">
<style type="text/css">
html{
perspective: 800px;
}
.box1{
transform-style: preserve-3d;
width: 200px;
height: 200px;
background-color: #bfa;
margin: 100px auto;
position: relative;
transition: all 2s;
animation: rollimg 10s linear infinite;
}
.box1>div{
position: absolute;
width: 200px;
height: 200px;
line-height: 200px;
text-align: center;
font-size: 100px;
opacity: .5;
transition: all 2s;
}
body:hover .box1{
transform: rotateY(90deg);
}
@keyframes rollimg{
from{
transform: rotateX(0) rotateY(0);
}
to{
transform: rotateX(360deg) rotateY(360deg);
}
}
.box1>div:nth-child(1){
background-color: yellow;
transform: rotateY(90deg) translateZ(100px);
}
.box1>div:nth-child(2){
background-color: orange;
transform: rotateY(-90deg) translateZ(100px);
}
.box1>div:nth-child(3){
background-color: red;
transform: rotateX(90deg) translateZ(100px);
}
.box1>div:nth-child(4){
background-color: green;
transform: rotateX(-90deg) translateZ(100px);
}
.box1>div:nth-child(5){
background-color: green;
transform: rotateX(0) translateZ(100px);
}
.box1>div:nth-child(6){
background-color: darkorange;
transform: rotateX(180deg) translateZ(100px);
}
</style>
</head>
<body>
<div class="box1">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
</body>
</html>