css实现三角形内彩色变换动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现三角形内彩色变换动画效果代码

代码标签: 彩色 变换 动画 效果

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


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

<head>

 
<meta charset="UTF-8">

 
 
<style>
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #000;
  overflow: hidden;
  --offset: 0s;
}
body .hover {
  position: absolute;
  z-index: 999;
  width: 100vw;
  height: 5vh;
  top: 0;
  left: 0;
}
body .hover:nth-of-type(1) {
  top: 0%;
}
body .hover:nth-of-type(1):hover ~ #kaleidoscope {
  --offset: -0.1s;
}
body .hover:nth-of-type(2) {
  top: 5%;
}
body .hover:nth-of-type(2):hover ~ #kaleidoscope {
  --offset: -0.2s;
}
body .hover:nth-of-type(3) {
  top: 10%;
}
body .hover:nth-of-type(3):hover ~ #kaleidoscope {
  --offset: -0.3s;
}
body .hover:nth-of-type(4) {
  top: 15%;
}
body .hover:nth-of-type(4):hover ~ #kaleidoscope {
  --offset: -0.4s;
}
body .hover:nth-of-type(5) {
  top: 20%;
}
body .hover:nth-of-type(5):hover ~ #kaleidoscope {
  --offset: -0.5s;
}
body .hover:nth-of-type(6) {
  top: 25%;
}
body .hover:nth-of-type(6):hover ~ #kaleidoscope {
  --offset: -0.6s;
}
body .hover:nth-of-type(7) {
  top: 30%;
}
body .hover:nth-of-type(7):hover ~ #kaleidoscope {
  --offset: -0.7s;
}
body .hover:nth-of-type(8) {
  top: 35%;
}
body .hover:nth-of-type(8):hover ~ #kaleidoscope {
  --offset: -0.8s;
}
body .hover:nth-of-type(9) {
  top: 40%;
}
body .hover:nth-of-type(9):hover ~ #kaleidoscope {
  --offset: -0.9s;
}
body .hover:nth-of-type(10) {
  top: 45%;
}
body .hover:nth-of-type(10):hover ~ #kaleidoscope {
  --offset: -1s;
}
body .hover:nth-of-type(11) {
  top: 50%;
}
body .hover:nth-of-type(11):hover ~ #kaleidoscope {
  --offset: -1.1s;
}
body .hover:nth-of-type(12) {
  top: 55%;
}
body .hover:nth-of-type(12):hover ~ #kaleidoscope {
  --offset: -1.2s;
}
body .hover:nth-of-type(13) {
  top: 60%;
}
body .hover:nth-of-type(13):hover ~ #kaleidoscope {
  --offset: -1.3s;
}
body .hover:nth-of-type(14) {
  top: 65%;
}
body .hover:nth-of-type(14):hover ~ #kaleidoscope {
  --offset: -1.4s;
}
body .hover:nth-of-type(15) {
  top: 70%;
}
body .hover:nth-of-type(15):hover ~ #kaleidoscope {
  --offset: -1.5s;
}
body .hover:nth-of-type(16) {
  top: 75%;
}
body .hover:nth-of-type(16):hover ~ #kaleidoscope {
  --offset: -1.6s;
}
body .hover:nth-of-type(17) {
  top: 80%;
}
body .hover:nth-of-type(17):hover ~ #kaleidoscope {
  --offset: -1.7s;
}
body .hover:nth-of-type(18) {
  top: 85%;
}
body .hover:nth-of-type(18):hover ~ #kaleidoscope {
  --offset: -1.8s;
}
body .hover:nth-of-type(19) {
  top: 90%;
}
body .hover:nth-of-type(19):hover ~ #kaleidoscope {
  --offset: -1.9s;
}
body .hover:nth-of-type(20) {
  top: 95%;
}
body .hover:nth-of-type(20):hover ~ #kaleidoscope {
  --offset: -2s;
}
body:before, body:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 50%;
  top: calc(50% + 75px);
  z-index: 10;
  -webkit-backdrop-filter: blur(5px);
          backdrop-filter: blur(5px);
}
body:after {
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
  height: 100%;
  top: 0;
  background: linear-gradient(to right, #000 calc(50% - 180px), transparent calc(50% - 180px), transparent calc(50% + 180px), #000 calc(50% + 180px));
}
body #svg {
  position: absolute;
}
body #kaleidoscope {
  width: 500px;
  height: 400px;
  position: absolute;
  top: calc(50% - 325px);
  -webkit-box-reflect: below 0px linear-gradient(rgba(0, 0, 0, 0.25) 50%, rgba(0, 0, 0, 0.05));
  overflow: hidden;
}
body #kaleidoscope > div {
  filter: url(#pixelate);
  width: 300px;
  height: 600px;
  position: absolute;
  overflow: hidden;
  left: 50%;
  background: linear-gradient(to right, #03001e, #7303c0, #ec38bc, #fdeff9, #ec38bc, #7303c0, #03001e);
  -webkit-box-reflect: left;
  transform: scale(0.75);
  transform-origin: left;
  top: 35px;
}
body #kaleidoscope > div:before, body #kaleidoscope > div:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9;
  border-radius: 0 500px 500px 0;
  -webkit-mask: linear-gradient(57.5deg, transparent 50%, #000 50%) 0% -100px/95% 115%, linear-gradient(to left, #000 25px, transparent 25px), linear-gradient(to top, #000 175px, transparent 100px);
}
body #kaleidoscope > div:after {
  -webkit-mask: none;
          mask: none;
  background: transparent;
  box-shadow: 0 0 0 150px #000;
  transform: scale(0.99);
  transform-origin: left;
}
body #kaleidoscope .wrap {
  width: 600px;
  height: 300px;
  left: calc(50% - 450px);
  top: calc(50% - 300px);
  position: absolute;
  transform-origin: 50% 100%;
  -webkit-animation: spin2 10s ease-in-out infinit.........完整代码请登录后点击上方下载按钮下载查看

网友评论0