div+css实现彩色彩虹三角形堆叠放大动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现彩色彩虹三角形堆叠放大动画效果代码

代码标签: div css 彩色 彩虹 三角形 堆叠 放大 动画

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

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

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

  
  
  
  
<style>
main {
  margin: auto;
  block-size: 60vmin;
  inline-size: 60vmin;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spin 32222ms infinite alternate ease-in-out;
}
div {
  animation: distanced 8000ms infinite alternate ease-in-out;
  offset-distance: 50%;
  offset-path: ray(var(--angle-start, 45deg) farthest-side);
  --angle-start: calc(45deg + (30deg * var(--i, 0)));
}
.rayed {
  animation: rayed 5000ms infinite linear;
  background: hsl(0 90% 98%);
  offset-rotate: auto 0.25turn;
}

body {
  block-size: 100vh;
  display: flex;
  flex-wrap: wrap;
  background: hsl(160 90% 2%);
  background: radial-gradient(circle, hsl(0 90% 3%), hsl(0 100% 0%));
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

@keyframes distanced {
  0% {
    offset-distance: -10%;
  }
  100% {
    offset-distance: 100%;
  }
}
@keyframes rayed {
  0% {
    offset-path: ray(var(--angle-start, 45deg) farthest-side);
  }
  100% {
    offset-path: ray(calc(var(--angle-start, 45deg) + 1turn) farthest-side);
  }
}
@keyframes spin {
  100% {
    transform: rotate(1turn);
  }
}

div {
  position: absolute;
  --side: 8.5vmin;
  --side-inner: 7vmin;
  --side-inner2: 5.5vmin;
  --side-inner3: 4vmin;
  block-size: calc(var(--side) * 2);
  inline-size: calc(var(--side) * 2);
  clip-path: polygon(
    evenodd,
    calc(50% + cos(0deg) * var(--side)) calc(50% + sin(0deg) * var(--side)),
    calc(50% + cos(120deg) * var(--side)) calc(50% + sin(120deg) * var(--side)),
    calc(50% + cos(240deg) * var(--side)) calc(50% + sin(240deg) * var(--side)),
    calc(50% + cos(0deg) * var(--side)) calc(50% + sin(0deg) * var(--side)),
    calc(50% + cos(0deg) * var(--side-inner))
      calc(50% + sin(0deg) * var(--side-inner)),
    calc(50% + cos(120deg) * var(--side-inner))
      calc(50% + sin(120deg) * var(--side-inner)),
    calc(50% + cos(240deg) * var(--side-inner))
      calc(50% + sin(240deg) * var(--side-inner)),
    ca.........完整代码请登录后点击上方下载按钮下载查看

网友评论0