本篇文章主要介绍用CSS3实现的水波扩散涟漪,圆波扩散,光圈扩散,雷达波向外散发动画。

预期效果应该是这样:,其实应该比这个更优美,因为设计师提供的gif出现透明度丢失问题,所以建议用css3实现。

一、明确参数

1、半径

30,42,54
2、透明度

100%,50%,20%
3、颜色

#fb7070

二、实现方案

1、border-width + animation

<div parent="box">
    <a id="J_dot"></a>
</div>
div[parent="box"] {
  position: relative;
  margin:50px auto;
  width:54px;
  height: 54px;
}
#J_dot{
  float: left;
  width: 54px;
  height: 54px;
  box-sizing: border-box;
  border-style:double;
  border-color: #fb7070;
  border-radius: 100%;
  animation: circleAnimation 1s infinite alternate;
}

@keyframes circleAnimation {
  from {
     border-width:;
  }
  to {
     border-width:27px;
  }
}

@-webkit-keyframes circleAnimation {
  from {
    border-width:;
  }
  to {
    border-width:27px;
  }
}

太假了,整个动画一直固定在大圆圈内,内圆圈似乎在来回放大缩小,离期望值太远!

2、box-shadow + background-color +animation

<div parent="box">
  <div class="outer-circle">
    <div class="inner-circle"></div>
  </div>
</div>
div[parent="box"] {
  position:relative;
  margin:50px auto;
  width:54px;
  height:54px;
}
.outer-circle {
  animation: circleAnimationOut 1.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.inner-circle {
  animation: circleAnimationIn 1.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.outer-circle, .inner-circle {
  position: absolute;
  z-index:;
  width: 30px;
  height: 30px;
  background: transparent;
  border-radius: 100%;
  animation-iteration-count: infinite;
}

@keyframes circleAnimationOut {
  0% {
    box-shadow: 0 0 0 0px rgba(251, 112, 112, 0.5);
  }
  100% {
    box-shadow: 0 0 0 24px rgba(251, 112, 112, 0.2);
  }
}
@keyframes circleAnimationIn {
  0% {
    box-shadow: 0 0 0 0px rgba(251, 112, 112, 0.5);
    background-color: rgba(251, 112, 112, 1);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(251, 112, 112, 0.5);
    background-color: rgba(251, 112, 112, 1);
  }
}

中间实心圆貌似没怎么动啊,效果还凑合。

3、box-shadow + transform +animation

<div parent="box">
  <div class="dot"></div>
  <div class="inner-circle"></div>
  <div class="outer-circle"></div>
</div>
@keyframes circleAnimationIn {
  0% {
    transform: scale(0.3);
    -webkit-transform: scale(0.3);
    opacity: 0.0;
  }
  25% {
    transform: scale(0.3);
    -webkit-transform: scale(0.3);
    opacity: 0.1;
  }
  50% {
    transform: scale(0.5);
    -webkit-transform: scale(0.5);
    opacity: 0.3;
  }
  75% {
    transform: scale(0.8);
    -webkit-transform: scale(0.8);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    -webkit-transform: scale(1);
    opacity: 0.0;
  }
}
@keyframes circleAnimationOut {
  0% {
    transform: scale(0.3);
    -webkit-transform: scale(0.3);
    opacity: 0.0;
  }
  25% {
    transform: scale(0.3);
    -webkit-transform: scale(0.3);
    opacity: 0.1;
  }
  50% {
    transform: scale(0.3);
    -webkit-transform: scale(0.3);
    opacity: 0.3;
  }
  75% {
    transform: scale(0.5);
    -webkit-transform: scale(0.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(0.8);
    -webkit-transform: scale(0.8);
    opacity: 0.0;
  }
}
div[parent="box"] {
  position: relative;
  margin: 50px auto;
  width: 54px;
  height: 54px;
}

/* 保持大小不变的小圆点 */
.dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-left: -9px;
  margin-top: -9px;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  background-color: #fb7070; /* 实心圆 ,如果没有这个就是一个小圆圈 */
  z-index:;
}

/* 产生动画(向外扩散变大)的圆圈 第一个圆 */
.inner-circle {
  position: absolute;
  z-index:;
  width: 54px;
  height: 54px;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  border: 1px solid #fb7070;
  -webkit-animation: circleAnimationIn 2s ease-out;
  -moz-animation: circleAnimationIn 2s ease-out;
  animation: circleAnimationIn 2s ease-out;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  box-shadow: 1px 1px 30px #fb7070;
}

/* 产生动画(向外扩散变大)的圆圈 第二个圆 */
.outer-circle {
  position: absolute;
  z-index:;
  width: 54px;
  height: 54px;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  border: 1px solid #fb7070;
  -webkit-animation: circleAnimationOut 2s ease-out;
  -moz-animation: circleAnimationOut 2s ease-out;
  animation: circleAnimationOut 2s ease-out;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  box-shadow: 1px 1px 30px #fb7070;
}

CSS3组件化之圆波扩散的更多相关文章

  1. CSS3组件化之ios版菊花loading

    <div class="juhua-loading"> <div class="jh-circle1 jh-circle-ios">&l ...

  2. CSS3组件化之菊花loading

    <div class="juhua-loading"> <div class="jh-circle"></div> < ...

  3. CSS3组件化之单线箭头

    <div class="parent-box"> <div class="top-arrow"></div> <div ...

  4. vue.js组件化开发实践

    前言 公司目前制作一个H5活动,特别是有一定统一结构的活动,都要码一个重复的轮子.后来接到一个基于模板的活动设计系统的需求,便有了下面的内容.借油开车. 组件化 需求一到,接就是怎么实现,技术选型自然 ...

  5. 实现checkbox组件化(Component)

    之前我写了一篇自定义checkbox的文章,通过css3实现自定义的checkbox,并没有使用当今流行的Reactjs, 或者Vuejs之类的进行组件化.但是很显然,这样封装的checkbox组件复 ...

  6. VUE.JS组件化

    VUE.JS组件化 前言 公司目前制作一个H5活动,特别是有一定统一结构的活动,都要码一个重复的轮子.后来接到一个基于模板的活动设计系统的需求,便有了下面的内容.借油开车. 组件化 需求一到,接就是怎 ...

  7. android弹力效果菜单、组件化项目、电影票选座控件的源码

    Android精选源码 android启动扫一扫和收付款的小部件源码 android弹力效果的抽屉菜单源码 对RecyclerView Item做动画 源码 android类似QQ空间,微信朋友圈,微 ...

  8. vue(9)—— 组件化开发 - webpack(3)

    前面两个终于把webpack相关配置解析完了.现在终于进入vue的开发了 vue组件化开发预热 前期准备 创建如下项目: app.js: footer.js: main.js: webpack.con ...

  9. Android组件化demo实现以及遇坑分享

    首先贴出demo的github地址:GitHub - TenzLiu/TenzModuleDemo: android组件化demo 作者:TenzLiu原文链接:https://www.jianshu ...

随机推荐

  1. 20155325 2016-2017-2 《Java程序设计》第6周学习总结

    教材学习内容总结 分类 输入流&输出流 字节流&字符流 节点流&处理流 核心方法 Input Stream int read(byte[]b,int off,int len) ...

  2. Linux基础-swap交换分区

    任务:对一块15G大小的硬盘进行分区,主分区为5G,扩展分区10G,一个逻辑分区5G作为swap交换分区,并激活查看新的swap分区 第一步,建立的新的SCSI硬盘,开启Linux系统前添加一块大小为 ...

  3. “榕树下·那年”移动app ( hybrid ) 开发总结

        榕树下网站本身的技术人员并不多,所以app开发的任务就到了母公司盛大文学这边.       盛大文学无线业务中心负责这次具体开发任务.       一如既往的,开发的情况是:时间紧,任务重,人 ...

  4. 洛谷 P4175: bzoj 1146: [CTSC2008]网络管理

    令人抓狂的整体二分题.根本原因还是我太菜了. 在学校写了一个下午写得头晕,回家里重写了一遍,一个小时就写完了--不过还是太慢. 题目传送门:洛谷P4175. 题意简述: 一棵 \(n\) 个结点的树, ...

  5. Cloud Lab: 泰晓实验云台【转】

    转自:http://tinylab.org/cloud-lab/ 可快速构建的计算机课程在线实验平台 由 Wu Zhangjin 创建于 2017/10/06 评论 打赏 项目描述 泰晓实验云台 项目 ...

  6. 查看linux服务器内存信息

    查看服务器内存信息 dmidecode|grep -P -A5 "Memory\s+Device"|grep Size [root@localhost home]# dmideco ...

  7. C# 读取指定文件夹下所有文件

    #region 读取文件 //返回指定目录中的文件的名称(绝对路径) string[] files = System.IO.Directory.GetFiles(@"D:\Test" ...

  8. word文档下划线无法显示的解决方法

    在编辑文档的时候经常会遇到下划线无法显示的情况,如图: 如果遇到不能在姓名后面加下划线的情况,我们该怎么做? 请看下面的图解: 1.首先点击左上角的office图标 2.点击右下角“word选项” 3 ...

  9. IDL界面程序直接调用envi菜单对应功能

    参考自http://blog.sina.com.cn/s/blog_764b1e9d010115qu.html 参考文章的方法是构建一个button控件,通过单击实现,这种方法比较复杂,不是我们经常能 ...

  10. linux创建新用户

    服务器只用root账号会有风险,最好是每个人使用一个账号. 1. 添加用户名 adduser linuxidc 2. 给这个用户名设置新密码 passwd linuxidc 3.授权 个人用户的权限只 ...