今天上午学习了css的最后一部分内容:动画,看到视频中的老师有展示一个魔方作业,并做出了一些演示跟讲解,下午的时候自己尝试着做了一下。
!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin:0;
padding:0;
}
div{
width: 300px;
height: 300px;
position: absolute;
text-align: center;
line-height: 300px;
animation:mymove 5s ;
}
body{
transform-style: preserve-3d;
height: 700px;
animation: fram1 10s ease;
width: 700px;
display: flex;
justify-content: center;
align-items: center;
}
.top{
background-color:aqua;
transform:rotateX(90deg) translateZ(150px);
}
.bottom{
background-color:#8A2BE2;
transform:rotateX(-90deg) translateZ(150px);
}
.left{
background-color:#FFEBCD;
transform:rotateY(-90deg) translateZ(150px);
}
.right{
background-color:bisque;
transform:rotateY(90deg) translateZ(150px);
}
.after{
background-color:aquamarine;
transform:rotateY(180deg) translateZ(150px);
}
.before{
background-color:brown;
transform:rotateY(0deg) translateZ(150px);
}
@keyframes fram1{
0%,100%{
transform: rotateY(0deg) rotateX(0deg);
}
50%{
transform: rotateY(180deg) rotateX(180deg);
}
}
</style>
</head>
<body>
<div class="top"></div>
<div class="bottom"></div>
<div class="left"></div>
<div class="right"></div>
<div class="after"></div>
<div class="before"></div>
</body>
</html>