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-d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0