水纹动画

//模仿一个网页,把水纹动画抽出。。。

<html>

<head>
    <meta content="charset=utf-8">
    <title>ripple</title>
    <style type="text/css">
        .ripple-box {
            width: 770px;
            height: 200px;
            position: absolute;
            z-index: 1;
            left: 50%;
            margin-left: -385px;
        }

        .ripple {
            opacity: 0;
            width: 100%;
            border: 4px solid rgba(255,105,17,.5);
            border-radius: 100%;
            height: 100%;
            left: 0;
            position: absolute;
            top: 0;
            -webkit-animation:rippleAni 5s ease 0s infinite normal;
        }

        @keyframes rippleAni {
            from {
                opacity: 1;
                transform: scale(0.1,.01);
            }

            to {
                opacity: 0;
                transform: scale(0.8,0.8);
            }
        }

        @-webkit-keyframes rippleAni {
            from {
                opacity: 1;
                -webkit-transform: scale(0.1,.01);
            }

            to {
                opacity: 0;
                -webkit-transform: scale(0.8,0.8);
            }
        }

        @-moz-keyframes rippleAni {
            from {
                opacity: 1;
                -moz-transform: scale(0.1,.01);
            }

            to {
                opacity: 0;
                -moz-transform: scale(0.8,0.8);
            }
        }

 
    </style>
</head>
<body>

    <div class="ripple-box">
        <div class="ripple" ></div>
        <div class="ripple" style="-webkit-animation-delay:1s;"></div>
        <div class="ripple" style="-webkit-animation-delay:2s;"></div>
        <div class="ripple" style="-webkit-animation-delay:3s;"></div>
        <div class="ripple" style="-webkit-animation-delay:4s;"></div>
    </div>

</body>

</html>

//又写了一下,加了片树叶 2015.05.05 11:27

<html>
<head>
    <title></title>
    <style type="text/css">
        #ripple_div{
            width: 300px;
            height: 130px;
            overflow: hidden;
            position: relative;
            margin: 50px auto;
        }
        #leaf{
            width: 200px;
            position: absolute;
            margin: 5px 0 0 50px;
            z-index: 1;
        }
        .ripple{
            -webkit-animation:rippleAni 5s ease 0 infinite normal;
            width: 100%;
            height: 100%;
            position: absolute;
            border-radius: 100%;
            border: solid 1px gray;
            z-index: 0;
        }
        @-webkit-keyframes rippleAni{
            from{
                opacity: 1;
                -webkit-transform:scale(0.1,0.01);
            }
            to{
                opacity: 0;
                --webkit-transform: scale(0.8,0.8);
            }
        }
    </style>
</head>
<body>
    
    <div id="ripple_div">
        <img id="leaf" src="https://img-my.csdn.net/uploads/201505/05/1430803263_9153.png-thumb.jpg">
         
    </div>
</body>
<script type="text/javascript">
    var ripple_div = document.getElementById("ripple_div");
    for(var i=0;i<5;i++){
        var ripple = document.createElement("div");
        ripple.setAttribute("class","ripple");
        ripple.setAttribute("style","-webkit-animation-delay:"+i+"s;");
        ripple_div.appendChild(ripple);
    }
         
</script>

</html>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值