其他代码

CSS3彩色进度条动画特效

阿里云


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

HTML 结构

  1. <div class="container">    
  2.   <div class="progress progress-striped">
  3.     <div class="progress-bar">
  4.     </div>                       
  5.   </div> 
  6. </div>
  7.  
  8. <div class="container">    
  9.   <div class="progress2 progress-moved">
  10.     <div class="progress-bar2" >
  11.     </div>                       
  12.   </div> 
  13. </div>
  14.  
  15. <div class="container">    
  16.   <div class="progress progress-infinite">
  17.     <div class="progress-bar3" >
  18.     </div>                       
  19.   </div> 
  20. </div>
也想出现在这里?联系我们
创客主机

css 样式

  1. body {
  2.   font-family: 'Montserrat', sans-serif;
  3.   background: #2c303a;
  4. }
  5.  
  6. .container {
  7.   margin: 100px auto;
  8.   width: 500px;
  9.   text-align: center;
  10. }
  11.  
  12. .progress {
  13.   padding: 6px;
  14.   background: rgba(0, 0, 0, 0.25);
  15.   border-radius: 6px;
  16.   box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px rgba(255, 255, 255, 0.08);
  17. }
  18.  
  19. .progress-bar {
  20.   height: 18px;
  21.   background-color: #ee303c;
  22.   border-radius: 4px;
  23.   transition: 0.4s linear;
  24.   transition-property: width, background-color;
  25. }
  26.  
  27. .progress-striped .progress-bar {
  28.   background-color: #FCBC51;
  29.   width: 100%;
  30.   background-image: linear-gradient(45deg, #fca311 25%, transparent 25%, transparent 50%, #fca311 50%, #fca311 75%, transparent 75%, transparent);
  31.   animation: progressAnimationStrike 6s;
  32. }
  33.  
  34. @keyframes progressAnimationStrike {
  35.   from {
  36.     width: 0;
  37.   }
  38.   to {
  39.     width: 100%;
  40.   }
  41. }
  42. .progress2 {
  43.   padding: 6px;
  44.   border-radius: 30px;
  45.   background: rgba(0, 0, 0, 0.25);
  46.   box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px rgba(255, 255, 255, 0.08);
  47. }
  48.  
  49. .progress-bar2 {
  50.   height: 18px;
  51.   border-radius: 30px;
  52.   background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05));
  53.   transition: 0.4s linear;
  54.   transition-property: width, background-color;
  55. }
  56.  
  57. .progress-moved .progress-bar2 {
  58.   width: 85%;
  59.   background-color: #EF476F;
  60.   animation: progressAnimation 6s;
  61. }
  62.  
  63. @keyframes progressAnimation {
  64.   0% {
  65.     width: 5%;
  66.     background-color: #F9BCCA;
  67.   }
  68.   100% {
  69.     width: 85%;
  70.     background-color: #EF476F;
  71.   }
  72. }
  73. .progress-bar3 {
  74.   height: 18px;
  75.   border-radius: 4px;
  76.   background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55);
  77.   transition: 0.4s linear;
  78.   transition-property: width, background-color;
  79. }
  80.  
  81. .progress-infinite .progress-bar3 {
  82.   width: 100%;
  83.   background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55);
  84.   animation: colorAnimation 1s infinite;
  85. }
  86.  
  87. @keyframes colorAnimation {
  88.   0% {
  89.     background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55);
  90.   }
  91.   20% {
  92.     background-image: linear-gradient(to right, #5ac8fa, #007aff, #7DC8E8, #5856d6, #ff2d55, #4cd964);
  93.   }
  94.   40% {
  95.     background-image: linear-gradient(to right, #007aff, #7DC8E8, #5856d6, #ff2d55, #4cd964, #5ac8fa);
  96.   }
  97.   60% {
  98.     background-image: linear-gradient(to right, #7DC8E8, #5856d6, #ff2d55, #4cd964, #5ac8fa, #007aff);
  99.   }
  100.   100% {
  101.     background-image: linear-gradient(to right, #5856d6, #ff2d55, #4cd964, #5ac8fa, #007aff, #7DC8E8);
  102.   }
  103. }

Codepen 网址:https://codepen.io/evawythien/pen/jegRxN

CSS3 彩色进度条动画特效

已有 407 人购买
  • zvkr
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(1)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!