css实现一个三维彩色壁画方块旋转穿梭动画效果代码

代码语言:html

所属分类:三维

代码描述:css实现一个三维彩色壁画方块旋转穿梭动画效果代码

代码标签: css 三维 方块 旋转 穿梭

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


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

<head>

 
<meta charset="UTF-8">

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

body {
  display: grid;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: #000;
  perspective: 50vmin;
  transform-style: preserve-3d;
  -webkit-animation: perspective 30s ease-in-out infinite;
          animation: perspective 30s ease-in-out infinite;
}

.scene {
  place-self: center;
  transform-style: preserve-3d;
  transform: translatez(50vmin);
  -webkit-animation: translate 30s ease-in-out infinite;
          animation: translate 30s ease-in-out infinite;
}

.cube {
  display: grid;
  transform-style: preserve-3d;
  -webkit-animation: rotation 30s linear infinite;
          animation: rotation 30s linear infinite;
}
.cube > * {
  place-self: center;
  position: absolute;
}
.cube > *:nth-of-type(1) {
  transform: translateZ(24.95vmin);
}
.cube > *:nth-of-type(2) {
  transform: rotateY(180deg) translateZ(24.95vmin);
}
.cube > *:nth-of-type(3) {
  transform: rotateY(90deg) translateZ(24.95vmin);
}
.cube > *:nth-of-type(4) {
  transform: rotateY(-90deg) translateZ(24.95vmin);
}
.cube > *:nth-of-type(5) {
  transform: rotateX(90deg) translateZ(24.95vmin);
}
.cube > *:nth-of-type(6) {
  transform: rotateX(-90deg) translateZ(24.95vmin);
}

.wall {
  display: grid;
  grid-gap: 3.8461538462vmin;
  grid-template-rows: repeat(2, 1fr);
  grid-template-columns: repeat(2, 1fr);
  height: 50vmin;
  width: 50vmin;
  padding: 3.8461538462vmin;
  border: 0.25vmin solid #000;
  background: #000;
}
.wall::before {
  content: "";
  height: 100%;
  width: 100%;
  position: absolute;
  opacity: 0.2;
  background-image: url(https://upload.wikimedia.org/wikipedia/commons/3/32/010.Pattern.090.Image.noise.filtered.jpg);
}
.wall:nth-child(1) > *:nth-of-type(1) {
  background: linear-gradient(-45deg, #eef257 0% 14.2857142857%, #d4dfa0 14.2857142857% 28.5714285714%, #3daa7f 28.5714285714% 42.8571428571%, #df650f 42.8571428571% 57.1428571429%, #342978 57.1428571429% 71.4285714286%, #5f9df0 71.4285714286% 85.7142857143%, #eb796f 85.7142857143% 100%);
}
.wall:nth-child(1) > *:nth-of-type(2) {
  background: linear-gradient(-45deg, #c403be 0% 14.2857142857%, #ccc126 14.2857142857% 28.5714285714%, #bb63e4 28.5714285714% 42.8571428571%, #d4257e 42.8571428571% 57.1428571429%, #839c73 57.1428571429% 71.4285714286%, #699e58 71.4285714286% 85.7142857143%, #916479 85.7142857143% 100%);
}
.wall:nth-child(1) > *:nth-of-type(3) {
  background: linear-gradient(90deg, #7ee4b4 0% 20%, #d4aa19 20% 40%, #a43c59 40% 60%, #cdba5e 60% 80%, #9d827f 80% 100%);
}
.wall:nth-child(1) > *:nth-of-type(4) {
  background: linear-gradient(90deg, #5bab94 0% 20%, #a2f77b 20% 40%, #1a9bd9 40% 60%, #ae4158 60% 80%, #d4914d 80% 100%);
}
.wall:nth-child(2) > *:nth-of-type(1) {
  background: linear-gradient(90deg, #bb2a2f 0% 20%, #4194e0 20% 40%, #97fc25 40% 60%, #f09f48 60% 80%, #2752d0 80% 100%);
}
.wall:nth-child(2) > *:nth-of-type(2) {
  background: linear-gradient(0deg, #41f2e4 0% 20%, #a8e722 20% 40%, #21dd22 40% 60%, #7cd3c4 60% 80%, #0e66e0 80% 100%);
}
.wall:nth-child(2) > *:nth-of-type(3) {
  background: linear-gradient(45deg, #e8c0b1 0% 14.2857142857%, #26b791 14.2857142857% 28.5714285714%, #6d4ef0 28.5714285714% 42.8571428571%, #dbfa22 42.85714.........完整代码请登录后点击上方下载按钮下载查看

网友评论0