div+css实现三维立体三角形毛毛虫蠕动动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现三维立体三角形毛毛虫蠕动动画效果代码

代码标签: div css 三维 立体 三角形 毛毛虫 蠕动 动画

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


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

<head>

  <meta charset="UTF-8">

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

body {
  background-color: #000;
  min-height: 100vh;
  display: grid;
  place-items: center;
  perspective: 1200px;
  overflow: hidden;
}
body *:not(:empty) {
  transform-style: preserve-3d;
}

.scene {
  position: relative;
  -webkit-animation: rotate 90s infinite linear;
          animation: rotate 90s infinite linear;
}
@-webkit-keyframes rotate {
  from {
    transform: rotateX(60deg) rotateZ(-210deg);
  }
  to {
    transform: rotateX(60deg) rotateZ(150deg);
  }
}
@keyframes rotate {
  from {
    transform: rotateX(60deg) rotateZ(-210deg);
  }
  to {
    transform: rotateX(60deg) rotateZ(150deg);
  }
}

.floor {
  position: absolute;
  inset: -40em;
  background-image: radial-gradient(circle, transparent, #000 40em), repeating-conic-gradient(#567 0 35deg, #678 0 55deg, #789 0 90deg);
  background-size: 100% 100%, 4.5em 4.5em;
  transform: translateZ(-2px);
  -webkit-animation: floorPos 1.5s infinite linear;
          animation: floorPos 1.5s infinite linear;
}
@-webkit-keyframes floorPos {
  to {
    background-position-x: center, -4.5em;
  }
}
@keyframes floorPos {
  to {
    background-position-x: center, -4.5em;
  }
}

.links {
  position: absolute;
  display: flex;
  gap: 0.5em;
  transform: translateX(-50%);
}

.link {
  width: 3em;
  height: 2em;
  -webkit-animation: cubeX 2s var(--delay, 0s) infinite ease-in-out;
          animation: cubeX 2s var(--delay, 0s) infinite ease-in-out;
}
.link > div {
  position: absolute;
  inset: 0;
  -webkit-animation: cubeZ 2s var(--delay, 0s) infinite ease-in-out;
          animation: cubeZ 2s var(--delay, 0s) infinite ease-in-out;
}
.link > div > div {
  position: absolute;
  inset: 0;
  background-color: #789;
  box-shadow: 0 0 1em #0008 inset;
  transform-style: preserve-3d;
  -webkit-animation: cubeR 2s var(--delay, 0s) infinite ease-in-out;
          animation: cubeR 2s var(--delay, 0s) infinite ease-in-out;
}
.link > div > div::before, .link > div > div::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: 0 0 1em #0008 inset;
}
.link > div > div::before {
  background-image: linear-gradient(#789, #def);
  transform: rotatex(60deg);
  transform-origin: top;
}
.link > div > div::after {
  background-image: linear-gradient(#def, #789);
  transform: rotatex(-60deg);
  transform-origin: bottom;
}
@-webkit-keyframes cubeZ {
  0%, 50%, 100% {
    transform: translateZ(0em);
  }
  25% {
    transform: translateZ(6em);
  }
}
@keyframes cubeZ {
  0%, 50%, 100% {
    transform: translateZ(0em);
  }
  25% {
    transform: translateZ(6em);
  }
}
@-webkit-keyframes cubeX {
  0%, 100% {
    transform: translateX(0em);
  }
  50% {
    transform: translateX(3em);
    -webkit-animation-timing-function: linear;
            animation-timing-function: linear;
  }
}
@keyf.........完整代码请登录后点击上方下载按钮下载查看

网友评论0