js+css实现随机炫酷万花筒动画效果代码

代码语言:html

所属分类:动画

代码描述:js+css实现随机炫酷万花筒动画效果代码

代码标签: js css 随机 炫酷 万花筒 动画

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

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

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

  
  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Tangerine:wght@400;700&display=swap');

*, *::before, *::after {
    padding: 0;
    margin: 0 auto;
    box-sizing: border-box;
}

body {
  font-family: "Tangerine", serif;
  background-color: #111;
  color: #fff;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.kaleidoscope {
  position: relative;
  font-size: 1vmin;
  cursor: pointer;
  border: none;
  background: none;
  
  &:active i {
    opacity: 0;
    -webkit-animation: none;
            animation: none;
  }
  
  &::after {
    content: 'Click to reset...';
    font-family: "Tangerine", serif;
    position: fixed;
    left: 1em; top: 1em;
    font-size: 2rem;
    color: #fff7;
  }
}

.side {
  position: absolute;
  width: 50em; height: 43.3em;
  background-color: #000;
  transform-origin: top left;
  transform:
    scaleX(var(--sx, 1))
    rotate(calc(var(--side) * 60deg))
    translate(-1px, -1px)
    skewX(30deg);
  -webkit-clip-path: polygon(0 0, 100% 0, 0 100%);
          clip-path: polygon(0 0, 100% 0, 0 100%);
  
  &:nth-child(odd) { --sx: -1; }
  
  i {
    position: absolute;
    inset: 0;
    border-radius: var(--_rad);
    box-shadow:
      0 0 10em hsl(var(--_hue) 100% 70%),
      0 0 10em hsl(var(--_hue) 100% 50%) inset;
    translate: var(--_x) var(--_y);
    -webkit-animation: i.........完整代码请登录后点击上方下载按钮下载查看

网友评论0