div+css实现三维钻石球旋转动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现三维钻石球旋转动画效果代码

代码标签: div css 三维 钻石 旋转 动画

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

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

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


  
  
<style>
input {
  display: none;
}

body {
  margin: 0;
  height: 100vh;
  background-image: linear-gradient(to bottom right, transparent, #333);
  font-size: .6vmin;
}

body * {
  position: absolute;
}

.wrapper {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to bottom left, #000, #011, #303);
  display: grid;
  animation: hue 2s ease-in-out infinite alternate;
}

@keyframes hue {
  0% {
    filter: saturate(4) contrast(1.5) hue-rotate(180deg);
  }
  100% {
    filter: saturate(5) contrast(2) hue-rotate(360deg);
  }
}

.playBtn {
  display: block;
  width: 30em;
  aspect-ratio: 1;
  background-color: black;
  align-self: end;
  margin: 10em;
  clip-path: polygon(0 0, 40% 20%, 40% 20%, 60% 30%, 60% 30%, 100% 50%, 100% 50%, 0 100%);
  transition: all .5s ease-in-out;
  transform-origin: 0 100%;
}

.playBtn:hover {
  scale: 1.2;
}

#playPause:checked ~ .wrapper .playBtn {
  clip-path: polygon(0 0, 40% 0%, 40% 100%, 60% 100%, 60% 0, 100% 0, 100% 100%, 0 100%);
}

#playPause:not(:checked) ~ .wrapper,
#playPause:not(:checked) ~ .wrapper :is(.pivot, .starHedron, .triangle),
#playPause:not(:checked) ~ .wrapper .pentagon::before {
  animation-play-state: paused;
}

.scene {
  place-self: center;
  width: 100em;
  aspect-ratio: 1;
  perspective: 250em;
}

.scene * {
  transform-style: preserve-3d;
}

.pivot, .starHedron {
  inset: 0;
}

.pivot {
  animation: wobble 8s ease-in-out alternate infinite;
}

@keyframes wobble {
  0% {
    rotate: x -30deg;
  }
  100% {
    r.........完整代码请登录后点击上方下载按钮下载查看

网友评论0