码迷,mamicode.com
首页 > 其他好文 > 详细

弹球落地

时间:2019-08-17 12:18:33      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:head   form   relative   lang   htm   pos   webkit   ram   gradient   

示例代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ball</title>
</head>
<style type="text/css">
.box{
width: 400px;
height: 300px;
border: 1px #ccc solid;
background-color: #eeeeee;
margin: 50px auto;
position: relative;
}
.box .ball{
width: 140px;
height: 140px;
border-radius: 50%;
position: absolute;
top: 0px;
left: 50%;
margin-left: -70px;
background: -webkit-linear-gradient(top,#fff,#999);
box-shadow: inset 0 0 30px #999,inset 0 -15px 70px #999999;
animation: ballmove 1s ease-in infinite;
}
.box .ball:after{
content: " ";
display: block;
width: 60px;
height: 30px;
border-radius: 50%;
position: absolute;
top: 10px;
left: 50%;
margin-left: -30px;
background: -webkit-linear-gradient(#ffffff,#cccccc);
z-index: 1;
}
.shadow{
width: 80px;
height: 60px;
border-radius: 50%;
position: absolute;
bottom: 0;
left: 50%;
margin-left: -40px;
background: rgba(20,20,2,0.1);
box-shadow: 0 0 20px 20px rgba(20,20,20,.1);
transform: scaleY(.3);
animation: shrink 1s ease-in infinite;
}
@keyframes ballmove {
0%{
top:0;
height: 140px;
}
65%{
top: 160px;
height: 140px;
}
75%{
height: 120px;
}
100%{
top: 0;
height: 140px;
}
}
@keyframes ballmove {
0%{
top:0;
height: 140px;
}
65%{
top: 160px;
height: 140px;
}
75%{
height: 120px;
}
100%{
top: 0;
height: 140px;
}
}
@keyframes shrink {
0%{
width: 90px;
height: 60px;
}
65%{
width: 10px;
height: 5px;
margin-left: -5px;
background-color: rgba(20,20,20,.3);
box-shadow: 0px 0px 25px 20px rgba(20,20,20,.3);
}
100%{
width: 90px;
height: 60px;
background-color: rgba(20,20,20,.1);
box-shadow: 0px 0px 25px 20px rgba(20,20,20,.1);
}
}
</style>
<body>
<div class="box">
<div class="ball"></div>
<div class="shadow"></div>
</div>
</body>
</html>
效果图:

技术图片

弹球落地

标签:head   form   relative   lang   htm   pos   webkit   ram   gradient   

原文地址:https://www.cnblogs.com/cxxBoo/p/11368071.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!