css3实现弹球效果

<style>
*{margin:0px;padding:0px;list-style: none;}
.box{width:400px;height:300px;border:1px solid #ccc;margin:30px auto;position:relative;}
.ball{width:140px;height:140px;
    border-radius: 50%;
    position:absolute;top:0;
    left:50%;margin-left:-70px;
    background:-webkit-linear-gradient(top,#fff,#999);
    box-shadow: inset 0 0 30px #999,inset 0 -15px 70px #999;
    -webkit-animation:jump 1s ease-in-out infinite;
    z-index:1;}
.ball:after{
    content: '';display: block;
    width:70px;height:30px;
    border-radius: 50%;position:absolute;top:10px;
    left:50%;margin-left:-35px;
    background:-webkit-linear-gradient(#fff,#ccc);}
.shadow{
    width:80px;height:60px;
    border-radius: 50%;position:absolute;
    bottom:0px;left:50%;
    margin-left: -40px;
    background: rgba(20,20,20,0.1);
    box-shadow: 0 0 25px 20px rgba(20,20,20,0.1);
    transform: scaleY(0.3);
    -webkit-animation: shrink 1s infinite;}
@-webkit-keyframes jump{
    0%{top:0;
        -webkit-animation-timing-function: ease-in;}
    65%{top:160px;height:140px;}
    75%{height:120px;}
    100%{top:0px;height:140px;}
}
@-webkit-keyframes shrink{
    0%{width:90px;height:60px;
        -webkit-animation-timing-function: ease-in;}
    65%{width:10px;height:5px;
        margin-left:-5px;
        background:rgba(20,20,20,0.3);
        box-shadow:0 0 25px 20px rgba(20,20,20,0.3);}
    100%{width:90px;height:60px;
        background: rgba(20,20,20,0.1);
        box-shadow: 0 0 25px 20px rgba(20,20,20,0.1);}
}
</style>

 

<div class="box">
        <div class="ball">
            
        </div>
        <div class="shadow"></div>
    </div>

转载于:https://my.oschina.net/u/3529780/blog/920067

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值