1. 程式人生 > >8.31學習筆記

8.31學習筆記

立方體 實例 -o webkit purple cti abs html enter

復習3d立方體

實例:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
body{
perspective: 2000px;
}
@-webkit-keyframes zhuan{
from{transform: rotateX(0) rotateY(0);}
to{transform: rotateX(360deg) rotateY(360deg);}
}
.box{
width: 400px;
height: 400px;
margin: 100px auto;
position: relative;
transform-style: preserve-3d;
animation: zhuan 3s linear infinite;
}
.box>div{
width: 400px;
height: 400px;
border: 1px solid pink;
position: absolute;
left:0;
top: 0;
text-align: center;
line-height:400px ;
}
.box>div:nth-of-type(1){
background: red;
transform: translateZ(200px);
transition: all 2s linear;
}
.box>div:nth-of-type(2){
background: orange;
transform: translateZ(-200px);
transition: all 2s linear;
}
.box>div:nth-of-type(3){
background: paleturquoise;
transform: rotateY(90deg) translateZ(-200px);
transition: all 2s linear;
}
.box>div:nth-of-type(4){
background: green;
transform: rotateY(90deg) translateZ(200px);
transition: all 2s linear;
}
.box>div:nth-of-type(5){
background: palevioletred;
transform: rotateX(90deg) translateZ(-200PX);
transition: all 2s linear;
}
.box>div:nth-of-type(6){
background: purple;
transform: rotateX(90deg) translateZ(200px);
transition: all 2s linear;
}
.box:hover .a1{
transform: translateZ(400px);
}
.box:hover .a2{
transform: translateZ(-400px);
}
.box:hover .a3{
transform: rotateY(90deg) translateZ(-400px);
}
.box:hover .a4{
transform: rotateY(90deg) translateZ(400px);
}
.box:hover .a5{
transform: rotateX(90deg) translateZ(-400PX);
}
.box:hover .a6{
transform: rotateX(90deg) translateZ(400PX);
}
</style>
</head>
<body>
<div class="box">
<div class="a1">1</div>
<div class="a2">2</div>
<div class="a3">3</div>
<div class="a4">4</div>
<div class="a5">5</div>
<div class="a6">6</div>
</div>
</body>
</html>

8.31學習筆記