为了账号安全,请及时绑定邮箱和手机立即绑定

【CSS】波纹效果

标签:
Html/CSS

700

微信订阅号:rabbit_svip

纯CSS3做动画,完全不兼容IE10之前的浏览器


479

微信订阅号:rabbit_svip

gif录得有点卡,拷个代码在本地体验一下。

HTML代码

<div id="container">
    <div class='circle circle--1'></div>
    <div class='circle circle--2'></div>
    <div class='circle circle--3'></div>
    <div class='circle circle--4'></div>
    <div class='circle circle--5'></div>
    <div class='circle circle--6'></div></div>

CSS代码

#container {    width: 500px;    height: 500px;    position: relative;    margin: 100px auto 0;    transition: opacity 1s;
}.circle {    position: absolute;    top: 50%;    left: 50%;    transform: translate(-50%, -50%);    border-radius: 50%;    animation: pulse 3s infinite ease-in-out;    background: #487ad3;
}.circle--1 {    opacity: 1;    animation-delay: 0.12s;
}.circle--2 {    opacity: 0.5;    animation-delay: 0.24s;
}.circle--3 {    opacity: 0.3333;    animation-delay: 0.36s;
}.circle--4 {    opacity: 0.25;    animation-delay: 0.48s;
}.circle--5 {    opacity: 0.2;    animation-delay: 0.6s;
}.circle--6 {    opacity: 0.1666;    animation-delay: 0.72s;
}.circle--1 {    width: 10%;    height: 10%;
}.circle--2 {    width: 20%;    height: 20%;
}.circle--3 {    width: 30%;    height: 30%;
}.circle--4 {    width: 40%;    height: 40%;
}.circle--5 {    width: 50%;    height: 50%;
}.circle--6 {    width: 60%;    height: 60%;
}

@keyframes pulse {
    0% {        transform: translate(-50%, -50%) scale(1);
    }
    25% {        transform: translate(-50%, -50%) scale(1.3);
    }
    50% {        transform: translate(-50%, -50%) scale(0.70);
    }
    75% {        transform: translate(-50%, -50%) scale(1);
    }
}section {    width: 500px;    height: 40px;    margin: 10px auto 0;    display: flex;    justify-content: space-around;
}section > div {    width: 100px;    height: 100%;    background-image: linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%);    text-align: center;    line-height: 40px;    color: #fff;    font-weight: 600;    font-size: 18px;    letter-spacing: 4px;    border-radius: 10px;
}




@keyframes: 定义动画用的。后面跟着动画名,大括号里设置要改变的属性。

animation: 会用动画。后面跟着动画名。

animation里面的 infinite 说明重复执行动画。

opacity: 设置不透明度。

animation-delay: 延迟执行。

display: flex 弹性盒布局




作者:滑滑兔
链接:https://www.jianshu.com/p/4bf992c2a0f3


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消