纯css实现仪表盘进度效果

代码语言:html

所属分类:进度条

代码描述:纯css实现仪表盘进度效果

代码标签: 仪表盘 进度 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:400,400italic,300italic,300,500,500italic'>
<style>
body {
  background: #232323;
  font-family: Roboto;
}
.progress {
  width: 200px;
  height: 200px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotateY(180deg);
}
.progress:before {
  content: "";
  position: absolute;
  width: 185px;
  height: 185px;
  background: #232323;
  border-radius: 100%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99;
}
.progress:after {
  content: "";
  position: absolute;
  width: 8px;
  height: 100px;
  background: linear-gradient(180deg, #d63031, #232323);
  border-radius: 10px;
  box-shadow: 0 -19px 9px -3px #d63031;
  top: 0;
  right: 50%;
  margin-right: -4px;
  z-index: 999;
  transform: rotate(90deg);
  transform-origin: bottom;
  animation-name: meter;
  animation-duration: 5s;
  animation-iteration-count: infinite;
  animation-timing-function: cubic-bezier(0, 0.1, 0.9, 0.81);
  animation-play-state: paused;
  animation-direction: reverse;
  animation-delay: 5s;
}
.progress .precent {
  position: absolute;
  top: 29px;
  left: 50%;
  z-index: 99;
  transform: translate(-50%, 0) rotateY(180deg);
  font-size: 19px;
  color: white;
  width: 47px;
  text-align: center;
  line-height: 1.5;
}
.progress .precent:after {
  content: "";
  position: absolute;
  width: 35px;
  height: 35px;
  background: #323232;
  border-radius: 100%;
  top: 85px;
  right: -35px;
}
.progress .precent:before {
  content: "";
  position: absolute;
  width: 35px;
  height: 35px;
  background: #323232;
  border-radius: 100%;
  top: 85px;
  left: -35px;
}
.progress .circle {
  width: 200px;
  height: 200px;
  background: white;
  background: conic-gradient(
    from 91deg,
    #d63031 0%,
    #ffffff 20%,
    transparent 100%
  );
  -webkit-clip-path: polygon(
    0% 100%,
    0% 0%,
    100% 0%,
    100% 50%,
    50% 50%,
    100% 50%,
    100% 100%
  );
  clip-path: polygon(
    0% 100%,
    0% 0%,
    100% 0%,
    100% 50%,
    50% 50%,
    100% 50%,
    100% 100%
  );
  animation-name: loading;
  animation-duration: 5s;
  animation-iteration-count: infinite;
  animation-timing-function: cubic-bezier(0, 0.1, 0.9, 0.81);
  animation-play-state: paused;
  animation-direction: reverse;
  animation-delay: 5s;
  border-radius: 100%;
}
@keyframes loading {
  0% {
    -webkit-clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      100% 50%,
      100% 100%
    );
    clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      100% 50%,
      100% 100%
    );
  }
  12.5% {
    -webkit-clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      100% 100%,
      100% 100%
    );
    clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      100% 100%,
      100% 100%
    );
  }
  25% {
    -webkit-clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      50% 100%,
      50% 100%
    );
    clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      50% 100%,
      50% 100%
    );
  }
  37.5% {
    -webkit-clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      0% 100%,
      0% 100%
    );
    clip-path: polygon(
      0% 100%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      0% 100%,
      0% 100%
    );
  }
  50% {
    -webkit-clip-path: polygon(
      0% 50%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      0% 50%,
      0% 50%
    );
    clip-path: polygon(
      0% 50%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      0% 50%,
      0% 50%
    );
  }
  62.5% {
    -webkit-clip-path: polygon(
      0% 0%,
      0% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      0% 0%,
      0% 0%
    );
    clip-path: polygon(0% 0%, 0% 0%, 100% 0%, 100% 50%, 50% 50%, 0% 0%, 0% 0%);
  }
  75% {
    -webkit-clip-path: polygon(
      50% 0%,
      50% 0%,
      100% 0%,
      100% 50%,
      50% 50%,
      50% 0%,
      50% 0%
    );
    clip-path: polygon(
      50% 0%,
      50% 0%,
      100% 0%,
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0