div+css实现三维立方体表面文字滚动动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现三维立方体表面文字滚动动画效果代码

代码标签: div css 三维 立方体 表面 文字 滚动 动画

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

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

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


  
<style>
@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,400;1,700&display=swap");
*, *::before, *::after {
  padding: 0;
  margin: 0 auto;
  box-sizing: border-box;
}

body {
  font-family: "Ubuntu", sans-serif;
  background-color: #000;
  min-height: 100vh;
  display: grid;
  place-items: center;
  perspective: 800px;
  overflow: hidden;
}
body * {
  transform-style: preserve-3d;
}

.cube {
  position: relative;
  font-size: min(1em, 3vmin);
  -webkit-animation: cube 45s infinite linear;
          animation: cube 45s infinite linear;
}
@-webkit-keyframes cube {
  from {
    transform: rotateX(0deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(720deg) rotateZ(360deg);
  }
}
@keyframes cube {
  from {
    transform: rotateX(0deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(720deg) rotateZ(360deg);
  }
}
.cube div {
  position: absolute;
  inset: -10em;
  background-color: #94b1ffcc;
  background-image: linear-gradient(calc(var(--dir1, 0) * -90deg + 45deg), transparent 23%, #fff7 0 24%, transparent 0 26%, #0007 0 27%, transparent 0);
  overflow: hidden;
  box-shadow: 0 0 5em #0008 inset;
}
.cube div:nth-child(1) {
  transform: translateZ(10em);
}
.cube div:nth-child(2) {
  transform: rotateY(90deg) translateZ(10em) rotate(-90deg);
}
.cube div:nth-child(3) {
  transform: rotateY(180deg) translateZ(10em) rotate(180deg);
}
.cube div:nth-child(4) {
  transform: rotateY(270deg) translateZ(10em) rotate(-90deg);
}
.cube div:nth-child(5) {
  transform: rotateX(90deg) translateZ(10em).........完整代码请登录后点击上方下载按钮下载查看

网友评论0