cs实现动画无延迟效果

代码语言:html

所属分类:动画

代码描述:cs实现动画无延迟效果

代码标签: 延迟 效果

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


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

<style>
* {
  box-sizing: border-box;
}
:root {
  --delay: 0;
  --duration: 2;
  --stagger-step: 0;
  --coefficient: 1;
  --offset: 0;
}
body {
  background: linear-gradient(-45deg, #111, #444);
  min-height: 100vh;
  display: -webkit-box;
  display: flex;
  color: #fff;
  -webkit-box-align: center;
          align-items: center;
  font-family: sans-serif;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
          flex-direction: column;
  text-align: center;
}
pre {
  background: #000;
  font-weight: bold;
  padding: 1rem;
  border-radius: 6px;
}
.block {
  -webkit-animation: party calc(var(--duration, 1) * 1s) linear infinite;
          animation: party calc(var(--duration, 1) * 1s) linear infinite;
  -webkit-animation-delay: calc((((var(--delay, 0) + (var(--index) * var(--stagger-step))) + var(--offset)) * var(--coefficient)) * 1s);
          animation-delay: calc((((var(--delay, 0) + (var(--index) * var(--stagger-step))) + var(--offset)) * var(--coefficient)) * 1s);
  background: #000;
  padding-top: 100%;
}
.container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-gap: 1vmin;
  width: 25vmin;
  margin: 4rem 0;
}
h1,
p,
pre {
  display: none;
  text-align: left;
  max-width: 550px;
}
code {
  line-height: 1.75;
  display: block;
}
[hidden] * {
  -webkit-animation: none;
          animation: none;
}
@-webkit-keyframes party {
  0% {
    background: hsl(0, 65%, 40%);
  }
  1% {
    background: hsl(3.6, 65%, 40%);
  }
  2% {
    background: hsl(7.2, 65%, 40%);
  }
  3% {
    background: hsl(10.8, 65%, 40%);
  }
  4% {
    background: hsl(14.4, 65%, 40%);
  }
  5% {
    background: hsl(18, 65%, 40%);
  }
  6% {
    background: hsl(21.6, 65%, 40%);
  }
  7% {
    background: hsl(25.2, 65%, 40%);
  }
  8% {
    background: hsl(28.8, 65%, 40%);
  }
  9% {
    background: hsl(32.4, 65%, 40%);
  }
  10% {
    background: hsl(36, 65%, 40%);
  }
  11% {
    background: hsl(39.6, 65%, 40%);
  }
  12% {
    background: hsl(43.2, 65%, 40%);
  }
  13% {
    background: hsl(46.800000000000004, 65%, 40%);
  }
  14% {
    background: hsl(50.4, 65%, 40%);
  }
  15% {
    background: hsl(54, 65%, 40%);
  }
  16% {
    background: hsl(57.6, 65%, 40%);
  }
  17% {
    background: hsl(61.2, 65%, 40%);
  }
  18% {
    background: hsl(64.8, 65%, 40%);
  }
  19% {
    background: hsl(68.4, 65%, 40%);
  }
  20% {
    background: hsl(72, 65%, 40%);
  }
  21% {
    backgro.........完整代码请登录后点击上方下载按钮下载查看

网友评论0