CSS3实现彩色进度条动画的示例


Posted in HTML / CSS onOctober 29, 2020

简要教程

CSS3实现彩色进度条动画的示例

这是一款css3彩色进度条动画特效。该CSS3进度条动画特效中包含了三种动画特效,它们通过HMTL代码和简单的CSS3来实现彩色进度条的不同动画效果。

CSS3实现彩色进度条动画的示例

使用方法

HTML结构

<div class="container">    
  <div class="progress progress-striped">
    <div class="progress-bar">
    </div>                       
  </div> 
</div>

<div class="container">    
  <div class="progress2 progress-moved">
    <div class="progress-bar2" >
    </div>                       
  </div> 
</div>

<div class="container">    
  <div class="progress progress-infinite">
    <div class="progress-bar3" >
    </div>                       
  </div> 
</div>

CSS结构

body {
  font-family: 'Montserrat', sans-serif;
  background: #2c303a;
}

.container {
  margin: 100px auto;
  width: 500px;
  text-align: center;
}

.progress {
  padding: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px rgba(255, 255, 255, 0.08);
}

.progress-bar {
  height: 18px;
  background-color: #ee303c;
  border-radius: 4px;
  transition: 0.4s linear;
  transition-property: width, background-color;
}

.progress-striped .progress-bar {
  background-color: #FCBC51;
  width: 100%;
  background-image: linear-gradient(45deg, #fca311 25%, transparent 25%, transparent 50%, #fca311 50%, #fca311 75%, transparent 75%, transparent);
  animation: progressAnimationStrike 6s;
}

@keyframes progressAnimationStrike {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}
.progress2 {
  padding: 6px;
  border-radius: 30px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px rgba(255, 255, 255, 0.08);
}

.progress-bar2 {
  height: 18px;
  border-radius: 30px;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05));
  transition: 0.4s linear;
  transition-property: width, background-color;
}

.progress-moved .progress-bar2 {
  width: 85%;
  background-color: #EF476F;
  animation: progressAnimation 6s;
}

@keyframes progressAnimation {
  0% {
    width: 5%;
    background-color: #F9BCCA;
  }
  100% {
    width: 85%;
    background-color: #EF476F;
  }
}
.progress-bar3 {
  height: 18px;
  border-radius: 4px;
  background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55);
  transition: 0.4s linear;
  transition-property: width, background-color;
}

.progress-infinite .progress-bar3 {
  width: 100%;
  background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55);
  animation: colorAnimation 1s infinite;
}

@keyframes colorAnimation {
  0% {
    background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55);
  }
  20% {
    background-image: linear-gradient(to right, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55, #4cd964);
  }
  40% {
    background-image: linear-gradient(to right, #007aff, #7DC8E8, #5856d6, #ff2d55, #4cd964, #5ac8fa);
  }
  60% {
    background-image: linear-gradient(to right, #7DC8E8, #5856d6, #ff2d55, #4cd964, #5ac8fa, #007aff);
  }
  100% {
    background-image: linear-gradient(to right, #5856d6, #ff2d55, #4cd964, #5ac8fa, #007aff, #7DC8E8);
  }
}

以上就是CSS3实现彩色进度条动画的示例的详细内容,更多关于CSS3 彩色进度条的资料请关注三水点靠木其它相关文章!

HTML / CSS 相关文章推荐
CSS3之多背景background使用示例
Oct 18 HTML / CSS
一款纯css3实现的非常实用的鼠标悬停特效演示
Nov 05 HTML / CSS
利用CSS3的border-radius绘制太极及爱心图案示例
May 17 HTML / CSS
CSS3制作漂亮的照片墙的实现代码
Jun 08 HTML / CSS
CSS3绘制六边形的简单实现
Aug 25 HTML / CSS
浅析CSS3中鲜为人知的属性:-webkit-tap-highlight-color
Jan 12 HTML / CSS
css3实现画半圆弧线的示例代码
Nov 06 HTML / CSS
浅谈CSS3 动画卡顿解决方案
Jan 02 HTML / CSS
html5的canvas实现3d雪花飘舞效果
Dec 27 HTML / CSS
原生 JS+CSS+HTML 实现时序图的方法
Jul 31 HTML / CSS
Canvas在超级玛丽游戏中的应用详解
Feb 06 HTML / CSS
CSS实现章节添加自增序号的方法
Jun 23 HTML / CSS
解决CSS3 transition-delay 属性默认值0不带单位失效的问题
Oct 29 #HTML / CSS
css3实现简单的白云飘动背景特效
Oct 28 #HTML / CSS
浅析CSS3 用text-overflow解决文字排版问题
Oct 28 #HTML / CSS
关于css中margin的值和垂直外边距重叠问题
Oct 27 #HTML / CSS
CSS3 实现弹跳的小球动画
Oct 26 #HTML / CSS
css3利用transform变形结合事件完成扇形导航
Oct 26 #HTML / CSS
CSS 3.0文字悬停跳动特效代码
Oct 26 #HTML / CSS
You might like
?繁体转换的class
2006/10/09 PHP
推荐一篇入门级的Class文章
2007/03/19 PHP
队列在编程中的实际应用(php)
2010/09/04 PHP
分割GBK中文遭遇乱码的解决方法
2013/08/09 PHP
php获取文件夹路径内的图片以及分页显示示例
2014/03/11 PHP
php编程实现简单的网页版计算器功能示例
2017/04/26 PHP
基于php流程控制语句和循环控制语句(讲解)
2017/10/23 PHP
Yii框架的布局文件实例分析
2019/09/04 PHP
Aliyun Linux 编译安装 php7.3 tengine2.3.2 mysql8.0 redis5的过程详解
2020/10/20 PHP
jquery无缝向上滚动实现代码
2013/03/29 Javascript
JS画5角星方法介绍
2013/09/17 Javascript
JS实现获取键盘按下的按键并显示在页面上的方法
2015/11/04 Javascript
6种javascript显示当前系统时间代码
2015/12/01 Javascript
推荐阅读的js快速判断IE浏览器(兼容IE10与IE11)
2015/12/13 Javascript
jQuery基本选择器(实例及表单域value的获取方法)
2016/05/20 Javascript
Javascript快速实现浏览器系统通知
2017/08/26 Javascript
seajs实现强制刷新本地缓存的方法分析
2017/10/16 Javascript
vue 项目build错误异常的解决方法
2019/04/22 Javascript
Vue页面手动刷新,实现导航栏激活项还原到初始状态
2020/08/06 Javascript
解决vue props传Array/Object类型值,子组件报错的情况
2020/11/07 Javascript
[36:02]DOTA2上海特级锦标赛D组小组赛#2 Liquid VS VP第一局
2016/02/28 DOTA
Python字符串替换实例分析
2015/05/11 Python
详解Python爬虫的基本写法
2016/01/08 Python
Python中如何获取类属性的列表
2016/12/26 Python
基于Python检测动态物体颜色过程解析
2019/12/04 Python
详解python日志输出使用配置文件格式
2021/02/10 Python
通过css3动画和opacity透明度实现呼吸灯效果
2019/08/09 HTML / CSS
基于HTML5超酷摄像头(HTML5 webcam)拍照功能实现代码
2012/12/13 HTML / CSS
canvas绘图按照contain或者cover方式适配并居中显示
2019/02/18 HTML / CSS
Rodd & Gunn澳大利亚官网:新西兰男装品牌
2018/09/25 全球购物
面向对象编程OOP的优点
2013/01/22 面试题
《要下雨了》教学反思
2014/02/17 职场文书
农村党员一句话承诺
2014/05/30 职场文书
2014年中班下学期工作总结
2014/12/11 职场文书
Nginx配置文件详解以及优化建议指南
2021/09/15 Servers
分享mysql的current_timestamp小坑及解决
2021/11/27 MySQL