css实现渐变三维板砖依次转动动画效果代码

代码语言:html

所属分类:三维

代码描述:css实现渐变三维板砖依次转动动画效果代码

代码标签: 三维 板砖 依次 转动 动画 效果

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

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

<head>

  <meta charset="UTF-8">

  
  
<style>
:root {
  --speed: 4s;
}

html {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(#607d8b 15%, #000000 100%);
  background: radial-gradient(#ffffff 15%, #b9b9b9 100%);
  font-family: Arial, Helvetica, sans-serif;
  box-sizing: border-box;
  height: 100%;
}

body * {
  box-sizing: border-box;
  outline: none;
}

.container {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  filter: hue-rotate(0deg);
  transition: all 1s ease 0s;
}

.grid {
  background: repeating-linear-gradient(
      150deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 49px,
      rgba(0, 0, 0, 0.1) 50px,
      rgba(255, 255, 255, 0) 51px
    ),
    repeating-linear-gradient(
      31deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 49px,
      rgba(0, 0, 0, 0.1) 50px,
      rgba(255, 255, 255, 0) 51px
    );
  position: fixed;
  width: 100vw;
  height: 100vh;
}

.item {
  position: relative;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 150px;
  transform-style: preserve-3d;
  transform: rotateX(-35deg) rotateY(45deg);
  transition: transform 0.5s ease 0s;
  animation: spin var(--speed) 0.05s infinite;
  z-index: -1;
  transform-origin: center center;
}

input#wide:checked ~ .container .item {
  animation-name: spin-wide;
}

.item > div {
  position: absolute;
  width: 150px;
  height: 150px;
  background: #4b08ba;
  background: #ff5500;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 5px -3px #fff inset;
  border: 1px solid rgb(255 255 255 / 5%);
  box-shadow: 0 0 5px -3px #00000030 inset;
}
.item > div:nth-child(2) {
  transform: rotateX(90deg) translate3d(0px, 7px, 7px);
  background: #ffa116;
  height: 14px;
}
.item > div:nth-child(3) {
  transform: rotateX(0deg) translate3d(0, 0, 14px);
}
.item > div:nth-child(4) {
  transform: rotateX(270deg) translate3d(0px, -7px, 143px);
  background: #ffa116;
  height: 14px;
}
.item > div:nth-child(5) {
  transform: rotateY(90deg) translate3d(-7px, 0, 143px);
  background: #e04b00;
  width: 14px !important;
}
.item > div:nth-child(6) {
  transform: rotateY(-90deg) translate3d(7px, 0, 7px);
  background: #e04b00;
  width: 14px !important;
}

.item:nth-child(2) {
  left: calc(50% - 10px);
  top: calc(50% - 156px);
  animation-delay: 0.1s;
  z-index: -2;
}
.item:nth-child(3) {
  left: calc(50% - 20px);
  top: calc(50% - 312px);
  animation-delay: 0.15s;
  z-index: -3;
}
.item:nth-child(4) {
  left: calc(50% - 30px);
  top: calc(50% - 468px);
  animation-delay: 0.2s;
  z-index: -4;
}
.item:nth-child(5) {
  left: calc(50% - 40px);
  top: calc(50% - 624px);
  animation-delay: 0.25s;
  z-index: -5;
}
.item:nth-child(6) {
  left: calc(50% - 50px);
  top: calc(50% - 780px);
  animation-delay: 0.3s;
  z-index: -6;
}
.item:nth-child(7) {
  left: calc(50% - 60px);
  top: calc(50% - 936px);
  animation-delay: 0.35s;
  z-index: -7;
}
.item:nth-child(8) {
  left: calc(50% - 70px);
  top: calc(50% - 1092px);
  animation-delay: 0.4s;
  z-index: -8;
}
.item:nth-child(9) {
  left: calc(50% - 80px);
  top: calc(50% - 1248px);
  animation-delay: 0.45s;
  z-index: -9;
}
.item:nth-child(10) {
  left: calc(50% - 90px);
  top: calc(50% - 1404px);
  animation-delay: 0.5s;
  z-index: -10;
}
.item:nth-child(11) {
  left: calc(50% - 100px);
  top: calc(50% - 1560px);
  animation-delay: 0.55s;
  z-index: -11;
}
.item:nth-child(12) {
  left: calc(50% - 110px);
  top: calc(50% - 1716px);
  animation-delay: 0.6s;
  z-index: -12;
}
.item:nth-child(13) {
  left: calc(50% - 120px);
  top: calc(50% - 1872px);
  animation-delay: 0.65s;
  z-index: -13;
}
.item:nth-child(14) {
  left: calc(50% - 130px);
  top: calc(50% - 2028px);
  animation-delay: 0.7s;
  z-index: -14;
}
.item:nth-child(15) {
  left: calc(50% - 140px);
  top: calc(50% - 2184px);
  animation-delay: 0.75s;
  z-index: -15;
}
.item:nth-child(16) {
  left: calc(50% - 150px);
  top: calc(50% - 2340px);
  animation-delay: 0.8s;
  z-index: -16;
}
.item:nth-child(17) {
  left: calc(50% - 160px);
  top: calc(50% - 2496px);
  animation-delay: 0.85s;
  z-index: -17;
}
.item:nth-child(18) {
  left: calc(50% - 170px);
  top: calc(50% - 2652px);
  animation-delay: 0.9s;
  z-index: -18;
}
.item:nth-child(19) {
  left: calc(50% - 180px);
  top: calc(50% - 2808px);
  animation-delay: 0.95s;
  z-index: -19;
}
.item:nth-child(20) {
  left: calc(50% - 190px);
  top: calc(50% - 2964px);
  animation-delay: 1s;
  z-index: -20;
}
.item:nth-child(21) {
  left: calc(50% - 200px);
  top: calc(50% - 3120px);
  animation-delay: 1.05s;
  z-index: -21;
}
.item:nth-child(22) {
  left: calc(50% - 210px);
  top: calc(50% - 3276px);
  animation-delay: 1.1s;
  z-index: -22;
}
.item:nth-child(23) {
  left: calc(50% - 220px);
  top: calc(50% - 3432px);
  animation-delay: 1.15s;
  z-index: -23;
}
.item:nth-child(24) {
  left: calc(50% - 230px);
  top: calc(50% - 3588px);
  animation-delay: 1.2s;
  z-index: -24;
}
.item:nth-child(25) {
  left: calc(50% - 240px);
  top: calc(50% - 3744px);
  animation-delay: 1.25s;
  z-index: -25;
}
.item:nth-child(26) {
  left: calc(50% - 250px);
  top: calc(50% - 3900px);
  animation-delay: 1.3s;
  z-index: -26;
}
.item:nth-child(27) {
  left: calc(50% - 260px);
  top: calc(50% - 4056px);
  animation-delay: 1.35s;
  z-index: -27;
}
.item:nth-child(28) {
  left: calc(50% - 270px);
  top: calc(50% - 4212px);
  animation-delay: 1.4s;
  z-index: -28;
}
.item:nth-child(29) {
  left: calc(50% - 280px);
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0