css3 animation实现动态波浪

10 篇文章 0 订阅

首先效果如图
在这里插入图片描述
animation 属性是一个用于设置css动画的简写属性。

<style type="text/css">
.wave{
        width:100px;
        height:100px;
        border-radius: 100px;
        background:#06c no-repeat center center;
        background-size:100%;
        animation: wave 3s -2s linear infinite;
        position: relative;
    }
    .wave::before,.wave::after{
        content: "";
        width: 100%;
        height: 100%;
        border-radius: 100px;
        background:#06c no-repeat center center;
        background-size:100%;
        position: absolute;
        top:50%;
        left: 50%;
        margin-left: -50px;
        margin-top: -50px;
    }
    /* 通过伪元素设置不同时间段的动画效果 */
    .wave::before{
        animation: wave 3s -1s linear infinite;
    }
    .wave::after{
        animation: wave 3s linear infinite;
    }
    @keyframes wave {
        0%{
        box-shadow: 0 0 0 0 rgba(245, 226, 226, 1);
        }
        50%{
        box-shadow: 0 0 0 20px rgba(245, 226, 226, 0.5);
        }
        100%{
        box-shadow: 0 0 0 40px rgba(245, 226, 226, 0);
        }
    }
</style>
<div class="wave"></div>
描述
animation-name规定需要绑定到选择器的 keyframe 名称
animation-duration规定完成动画所花费的时间,以秒或毫秒计
animation-timing-function规定动画的速度曲线
animation-delay规定在动画开始之前的延迟
animation-iteration-count规定动画应该播放的次数
animation-direction规定是否应该轮流反向播放动画

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值