纯css实现秒表效果

代码语言:html

所属分类:动画

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

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

<title> Stopwatch icon w/ CSS animation</title>

<style>
      .icon-holder {
  width: 6rem;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}
.icon-holder div {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
}
.icon-holder div svg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
}
.icon-holder div svg #button-top {
  -webkit-animation: button-top 4s ease 0s infinite;
          animation: button-top 4s ease 0s infinite;
}
.icon-holder div svg #big-hand {
  -webkit-transform-origin: 50% 55.85%;
          transform-origin: 50% 55.85%;
  -webkit-animation: big-hand 4s cubic-bezier(0.93, 0.3, 0.3, 0.93) 0.25s infinite;
          animation: big-hand 4s cubic-bezier(0.93, 0.3, 0.3, 0.93) 0.25s infinite;
}

@-webkit-keyframes button-top {
  0% {
    -webkit-transform: translate(0, 0);
            transform: translate(0, 0);
  }
  2% {
    -webkit-transform: translate(0, -8px);
            transform: translate(0, -8px);
  }
  5% {
    -webkit-transform: translate(0px, 15px);
            transform: translate(0px, 15px);
  }
  8% {
    -webkit-transform: translate(0, -5px);
            transform: translate(0, -5px);
  }
  10% {
    -webkit-transform: translate(0, 0);
            transform: translate(0, 0);
  }
}

@keyframes button-top {
  0% {
    -webkit-transform: translate(0, 0);
            transform: translate(0, 0);
  }
  2% {
    -webkit-transform: translate(0, -8px);
            transform: translate(0, -8px);
  }
  5% {
    -webkit-transform: translate(0px, 15px);
            transform: translate(0px, 15px);
  }
  8% {
    -webkit-t.........完整代码请登录后点击上方下载按钮下载查看

网友评论0