css实现三维分裂金字塔旋转动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现三维分裂金字塔旋转动画效果代码

代码标签: 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;
  color: #fff;
  min-height: 100vh;
  display: grid;
  place-items: center;
  perspective: 800px;
  
  *:not(:empty) {
    transform-style: preserve-3d;
  }
}

.scene {
  position: relative;
  -webkit-animation: sceneRotate 60s infinite linear;
          animation: sceneRotate 60s infinite linear;
}

@-webkit-keyframes sceneRotate {
  from { transform: translateY(10em) rotateX(-15deg) rotateY(0deg); }
  to { transform: translateY(10em) rotateX(-15deg) rotateY(-360deg); }
}

@keyframes sceneRotate {
  from { transform: translateY(10em) rotateX(-15deg) rotateY(0deg); }
  to { transform: translateY(10em) rotateX(-15deg) rotateY(-360deg); }
}

.floor {
  position: absolute;
  inset: -60em;
  background-image:
    radial-gradient(closest-side, transparent, #000),
    repeating-radial-gradient(circle at calc(cos(0deg) * 25% + 50%) calc(sin(0deg) * 25% + 50%), transparent 0, #fdd2, transparent 1em),
    repeating-radial-gradient(circle at calc(cos(72deg) * 25% + 50%) calc(sin(72deg) * 25% + 50%), transparent 0, #fdd2, transparent 1em),
    repeating-radial-gradient(circle at calc(cos(144deg) * 25% + 50%) calc(sin(144deg) * 25% + 50%), transparent 0, #fdd2, transparent 1em),
    repeating-radial-gradient(circle at calc(cos(216deg) * 25% + 50%) calc(sin(216deg) * 25% + 50%), transparent 0, #fdd2, transparent 1em),
    repeating-radial-gradient(circle at calc(cos(288deg) * 25% + 50%) calc(sin(288deg) * 25% + 50%), transparent 0, #fdd2, transparent 1em);
  transform: rotateX(90deg);
}

.pyramid {
  position: absolute;
  
  --bricks:
    linear-gradient(155deg, brown 0.375em, transparent 0.375em) 0.625em 0.125em / 1em 1em,
    linear-gradient(155deg, brown 0.375em, transparent 0.375em) 0.125em 0.625em / 1em 1em,
    linear-gradient(335deg, maroon 0.375em, transparent 0.375em) 0 0.025em / 1em 1em,
    linear-gradient(335deg, maroon 0.375em, transparent 0.375em) 0.5em 0.525em / 1em 1em;
  
  div {
    position: absolute;
    bottom: 0;
    background: linear-gradient(10deg, #0007,.........完整代码请登录后点击上方下载按钮下载查看

网友评论0