模拟小球下落:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
.b1{
height: 500px;
border-bottom: 8px brown solid;
margin:50px auto;
overflow: hidden;
}
.b2{
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #bfa;
animation: ball 1s forwards ease-in;
}
@keyframes ball{
from{
margin-top: 0;
}
10%,30%,50%,70%,90%,to{
margin-top: 400px;
animation-timing-function: ease-out;
}
20%{
margin-top: 100px;
}
40%{
margin-top: 200px;
}
60%{
margin-top: 300px;
}
80%{
margin-top: 350px;
}
95%{
margin-top: 380px;
}
}
</style>
</head>
<body>
<div class="b1">
<div class="b2"></div>
</div>
</body>
</html>