div+css实现三维字母变形logo动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现三维字母变形logo动画效果代码

代码标签: div css 三维 字母 变形 logo 动画

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


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

<head>

  <meta charset="UTF-8">
  

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

:root {
  --color-back: #000000;
  --color-s-light: #fd308f;
  --color-s-dark: #19060e;
  --color-e-light: #00d9ee;
  --color-e-dark: #171f2e;
  --color-t-light: #00ffcf;
  --color-t-dark: #202d35;
}

body {
  background-image: radial-gradient(circle, #000, #222 50em);
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-size: 42px;
  perspective: 100em;
}
body *:not(:empty) {
  transform-style: preserve-3d;
}

.scene {
  position: relative;
}

.set {
  position: absolute;
  transform: rotateX(-30deg);
  width: 5em;
  height: 5em;
}
.set > .letter {
  position: absolute;
  inset: 0;
  -webkit-animation: latterScale 4s var(--delay, 0s) infinite backwards;
          animation: latterScale 4s var(--delay, 0s) infinite backwards;
}
@-webkit-keyframes latterScale {
  0%, 50%, 100% {
    transform: var(--letter-transform) translateZ(3.75em) scaleZ(1);
  }
  56%, 94% {
    transform: var(--letter-transform) translateZ(3.75em) scaleZ(7.5);
  }
  62%, 88% {
    transform: var(--letter-transform) translateZ(-2.75em) scaleZ(1);
  }
}
@keyframes latterScale {
  0%, 50%, 100% {
    transform: var(--letter-transform) translateZ(3.75em) scaleZ(1);
  }
  56%, 94% {
    transform: var(--letter-transform) translateZ(3.75em) scaleZ(7.5);
  }
  62%, 88% {
    transform: var(--letter-transform) translateZ(-2.75em) scaleZ(1);
  }
}
.set > .letter::before, .set > .letter::after {
  content: "";
  position: absolute;
  inset: 0;
}
.set > .letter::before {
  background-color: var(--color-back);
}
.set > .letter::after {
  background-color: var(--_color-light);
}
.set > .letter > div {
  position: absolute;
  background-color: var(--_color-dark);
  border: 0.04em solid var(--_color-light);
}

.s {
  --letter-transform: rotateY(-45deg);
  --_color-light: var(--color-s-light);
  --_color-dark: var(--color-s-dark);
}
.s::before {
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 20%, 20% 20%, 20% 40%, 100% 40%, 100% 100%, 0 100%, 0 80%, 80% 80%, 80% 60%, 0 60%);
          clip-path: polygon(0 0, 100% 0, 100% 20%, 20% 20%, 20% 40%, 100% 40%, 100% 100%, 0 100%, 0 80%, 80% 80%, 80% 60%, 0 60%);
}
.s::after {
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 20%, 20% 20%, 20% 40%, 100% 40%, 100% 100%, 0 100%, 0 80%, 80% 80%, 80% 60%, 0 60%, 0 0, 2% 2%, 2% 58%, 82% 58%, 82% 82%, 2% 82%, 2% 98%, 98% 98%, 98% 42%, 18% 42%, 18% 18%, 98% 18%, 98% 2%, 2% 2%);
          clip-path: polygon(0 0, 100% 0, 100% 20%, 20% 20%, 20% 40%, 100% 40%, 100% 100%, 0 100%, 0 80%, 80% 80%, 80% 60%, 0 60%, 0 0, 2% 2%, 2% 58%, 82% 58%, 82% 82%, 2% 82%, 2% 98%, 98% 98%, 98% 42%, 18% 42%, 18% 18%, 98% 18%, 98% 2%, 2% 2%);
}
.s > div:nth-child(1) {
  width: 5em;
  height: 1em;
  transform-origin: top;
  transform: rotateX(-90deg);
}
.s > div:nth-child(2) {
  right: 0;
  width: 1em;
  height: 1em;
  transform-origin: right;
  transform: rotateY(-90deg);
}
.s > div:nth-child(3) {
  top: 1em;
  width: 1em;
  height: 1em;
  transform-origin: right;
  transform: rotateY(-90deg);
}
.s > div:nth-child(4) {
  left: 1em;
  top: 2em;
  width: 4em;
  height: 1em;
  transform-origin: top;
  transform: rotateX(-90deg);
}
.s > div:nth-child(5) {
  right: 0;
  top: 2em;
  width: 1em;
  height: 3em;
  transform-origin: right;
  transform: rotateY(-90deg);
}
.s > div:nth-child(6) {
  top: 4em;
  width: 4em;
  height: 1em;
  transfor.........完整代码请登录后点击上方下载按钮下载查看

网友评论0