<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>树叶飘落动画</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
ul,ol{
list-style: none;
}
a{
text-decoration: none;
color: #000000;
}
section{
height: 600px;
border-bottom: 1px solid #000000;
position: relative;
}
.big{
/*利用定位调整树叶位置*/
position: absolute;
width: 240px;
height: 152px;
background: url("image/page.png");
left: 400px;
bottom: 150px;
}
.small{
position: absolute;
width: 89px;
height: 63px;
background: url("image/page.png") 0 -152px;
left: 250px;
top: 50px;
/*调用动画*/
-webkit-animation: leaf 5s linear 0s infinite;
}
/*定义动画*/
@-webkit-keyframes leaf {
0%{
/*在天上准备掉落 opacity(透明度)*/
opacity: 0;
/*移动 旋转 每一个状态样式属性必须一一对应*/
/*一个元素可以有多个变形 用空格隔开*/
transform: rotate(0deg) translate(0,0);
}
30%{
/*掉落在空中*/
opacity: 1;
transform: rotate(5deg) translate(200px,180px);
}
60%{
/*掉落在地下*/
opacity: 0;
transform: rotate(10deg) translate(400px,360px);
}
100%{
/*利用60-100对应的时间模拟等待*/
opacity: 0;
transform: rotate(10deg) translate(400px,360px);
}
}
</style>
</head>
<body>
<section>
<div class="big"></div>
<div class="small"></div>
</section>
</body>
</html>
树叶飘落动画
最新推荐文章于 2023-06-02 16:12:01 发布