css实现三维多彩方形灯光旋转动画效果代码
代码语言:html
所属分类:三维
代码描述:css实现三维多彩方形灯光旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html>
<head>
<style>
*, *::before, *::after {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
background-color: #000;
color: #fff;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
perspective: 750px;
overflow: hidden;
}
.container {
position: relative;
transform-style: preserve-3d;
-webkit-animation: rotate 32.4s infinite linear;
animation: rotate 32.4s infinite linear;
}
@-webkit-keyframes rotate {
from {
transform: rotatex(0deg) rotateY(0deg) rotateZ(0deg);
}
to {
transform: rotatex(360deg) rotateY(720deg) rotateZ(360deg);
}
}
@keyframes rotate {
from {
transform: rotatex(0deg) rotateY(0deg) rotateZ(0deg);
}
to {
transform: rotatex(360deg) rotateY(720deg) rotateZ(360deg);
}
}
.pole {
position: absolute;
transform-style: preserve-3d;
}
.pole:nth-child(1) {
transform: rotate(0deg) translateX(150px);
}
.pole:nth-child(1) > div::before {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
.pole:nth-child(2) {
transform: rotate(60deg) translateX(150px);
}
.pole:nth-child(2) > div::before {
-webkit-animation-delay: -3s;
animation-delay: -3s;
}
.pole:nth-child(3) {
transform: rotate(120deg) translateX(150px);
}
.pole:nth-child(3) > div::before {
-webkit-animation-delay: -5s;
animation-delay: -5s;
}
.pole:nth-child(4) {
transform: rotate(180deg) translateX(150px);
}
.pole:nth-child(4) > div::before {
-webkit-animation-delay: -7s;
animation-delay: -7s;
}
.pole:nth-child(5) {
transform: rotate(240deg) translateX(150px);
}
.pole:nth-child(5) > div::before {
-webkit-animation-delay: -9s;
animation-delay: -9s;
}
.pole:nth-child(6) {
transform: rotate(300deg) translateX(150px);
}
.pole:nth-child(6) > div::before {
-webkit-animation-delay: -11s;
animation-delay: -11s;
}
.pole > div {
position: absolute;
background-color: #111;
box-shadow: 0 0 25px #000 inset;
overflow: hidden;
}
.pole > div::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100px;
opacity: 0.25;
animation: poleBack 4s infinite linear, poleColor 12s infinite step-end reverse;
}
@-webkit-keyframes poleBack {
0% {
transform: translate(-50%, calc(-50% + (var(--pb1) * 50px))) skewY(calc(var(--pb2) * 1));
}
100% {
transform: translate(-50%, calc(-50% - (var(--pb1) * 50px))) skewY(calc(var(--pb2) * -1));
}
}
@keyframes poleBack {
0% {
transform: translate(-50%, calc(-50% + (var(--pb1) * 50px))) skewY(calc(var(--pb2) * 1));
}
100% {
transform: translate(-50%, calc(-50% - (var(--pb1) * 50px))) skewY(calc(var(--pb2) * -1));
}
}
@-webkit-keyframes poleColor {
0% {
background-image: linear-gradient(#0ff0, #0ff, #0ff0);
}
33.333% {
background-image: linear-gradient(#f0f0, #f0f, #f0f0);
}
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0