CSS3组件化之圆波扩散
本篇文章主要介绍用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组件化之圆波扩散的更多相关文章
- CSS3组件化之ios版菊花loading
<div class="juhua-loading"> <div class="jh-circle1 jh-circle-ios">&l ...
- CSS3组件化之菊花loading
<div class="juhua-loading"> <div class="jh-circle"></div> < ...
- CSS3组件化之单线箭头
<div class="parent-box"> <div class="top-arrow"></div> <div ...
- vue.js组件化开发实践
前言 公司目前制作一个H5活动,特别是有一定统一结构的活动,都要码一个重复的轮子.后来接到一个基于模板的活动设计系统的需求,便有了下面的内容.借油开车. 组件化 需求一到,接就是怎么实现,技术选型自然 ...
- 实现checkbox组件化(Component)
之前我写了一篇自定义checkbox的文章,通过css3实现自定义的checkbox,并没有使用当今流行的Reactjs, 或者Vuejs之类的进行组件化.但是很显然,这样封装的checkbox组件复 ...
- VUE.JS组件化
VUE.JS组件化 前言 公司目前制作一个H5活动,特别是有一定统一结构的活动,都要码一个重复的轮子.后来接到一个基于模板的活动设计系统的需求,便有了下面的内容.借油开车. 组件化 需求一到,接就是怎 ...
- android弹力效果菜单、组件化项目、电影票选座控件的源码
Android精选源码 android启动扫一扫和收付款的小部件源码 android弹力效果的抽屉菜单源码 对RecyclerView Item做动画 源码 android类似QQ空间,微信朋友圈,微 ...
- vue(9)—— 组件化开发 - webpack(3)
前面两个终于把webpack相关配置解析完了.现在终于进入vue的开发了 vue组件化开发预热 前期准备 创建如下项目: app.js: footer.js: main.js: webpack.con ...
- Android组件化demo实现以及遇坑分享
首先贴出demo的github地址:GitHub - TenzLiu/TenzModuleDemo: android组件化demo 作者:TenzLiu原文链接:https://www.jianshu ...
随机推荐
- HDU 1017 A Mathematical Curiosity 数学题
解题报告:输入两个数,n和m,求两个数a和b满足0<a<b<n,并且(a^2+b^2+m) % (a*b) =0,这样的a和b一共有多少对.注意这里的b<n,并不可以等于n. ...
- imperva-代理安装
首先创建网关上面的监听端口
- win7 64位mysql安装及navicat 解压版
教程:http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html Mysql修改设置root密码的命令及方法:http://jingy ...
- python基础--os模块和sys模块
os模块提供对操作系统进行调用的接口 # -*- coding:utf-8 -*-__author__ = 'shisanjun' import os print(os.getcwd())#获取当前工 ...
- python网络编程-动态导入和断言
一:动态导入importlib 在程序运行的过程中,根据变量或者配置动态的决定导入哪个模块,可以使用模块importlib importlib使用示例 二:断言assert 如果接下来的程序依赖于前面 ...
- ExtJs对js基本语法扩展支持
ExtJs对js基本语法扩展支持 本篇主要介绍一下ExtJs对JS基本语法的扩展支持,包括动态加载.类的封装等. 一.动态引用加载 ExtJs有庞大的类型库,很多类可能在当前的页面根本不会用到,我们可 ...
- 洛谷P2812校园网络
传送门啦 其实这个题只要读懂分析好题意就不是很难. 就是将一个有向图进行缩点操作,把一个强连通分量看成一个点,求入度为 0 的点和出度为 0 的点各有多少. 在这里先向大家推荐两个题目,建议大家先去看 ...
- 配置vuejs加载模拟数据
[个人笔记,非技术博客] 1.使用前确保安装axios插件,vuejs官方推荐,当然使用其他插件也可以 2.配置dev-server.js var router = express.Router(); ...
- PreparedStatement 查询 In 语句 setArray 等介绍。
ps = conn.prepareStatement("SELECT tid,jdp_response FROM jdp_tb_trade WHERE tid IN (?) ORDER BY ...
- python 统计MySQL表信息
一.场景描述 线上有一台MySQL服务器,里面有几十个数据库,每个库有N多表. 现在需要将每个表的信息,统计到excel中,格式如下: 库名 表名 表说明 建表语句 db1 users 用户表 CRE ...