div+Css实现正方形拼凑数字翻牌计数器动画代码

代码语言:html

所属分类:动画

代码描述:div+Css实现正方形拼凑数字翻牌计数器动画代码

代码标签: div Css 正方形 拼凑 数字 翻牌 计数器 动画 代码

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  



  
  
  
<style>
*, *:after, *:before {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  display: grid;
  place-content: center;
  background: #FF5722;
}

.container {
  position: relative;
  perspective: 750vw;
  justify-content: center;
  display: grid;
  gap: 4px;
  grid-template-columns: 10vw 10vw 10vw;
  filter: drop-shadow(0 1.6666666667vw 1vw #0007);
}

.box {
  width: 10vw;
  height: 10vw;
  position: relative;
  transform-style: preserve-3d;
  transform: translate3d(0, 0, 0);
}
.box:nth-child(1) {
  animation: an1 10s linear infinite;
}
@keyframes an1 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
}
.box:nth-child(2) {
  animation: an2 10s linear infinite;
}
@keyframes an2 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
}
.box:nth-child(3) {
  animation: an3 10s linear infinite;
}
@keyframes an3 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
}
.box:nth-child(4) {
  animation: an4 10s linear infinite;
}
@keyframes an4 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
}
.box:nth-child(5) {
  animation: an5 10s linear infinite;
}
@keyframes an5 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 0deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 0deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
}
.box:nth-child(6) {
  animation: an6 10s linear infinite;
}
@keyframes an6 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
}
.box:nth-child(7) {
  animation: an7 10s linear infinite;
}
@keyframes an7 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -540deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -630deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -630deg);
  }
}
.box:nth-child(8) {
  animation: an8 10s linear infinite;
}
@keyframes an8 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 0deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 0deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -450deg);
  }
}
.box:nth-child(9) {
  animation: an9 10s linear infinite;
}
@keyframes an9 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  55%, 60% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  65%, 70% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  75%, 80% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  85%, 90% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  95%, 100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
}
.box:nth-child(10) {
  animation: an10 10s linear infinite;
}
@keyframes an10 {
  0% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  5%, 10% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -90deg);
  }
  15%, 20% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -180deg);
  }
  25%, 30% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -270deg);
  }
  35%, 40% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  45%, 50% {
    transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, -360deg);
  }
  55%, .........完整代码请登录后点击上方下载按钮下载查看

网友评论0