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); } 66.666% { background-image: linear-gradient(#ff00, #ff0, #ff00); } } @keyframes poleColor { 0% { background-image: linear-gradient(#0ff0, #0ff, #0ff0); } 33.333% { background-image: linear-gradient(#f0f0, #f0f, #f0f0); } 66.666% { background-image: linear-gradient(#ff00, #ff0, #ff00); } } .pole > div:nth-child(1) { width: 50px; height: 202.5px; transform: translate(-50%, -50%) translateZ(25px); -webkit-clip-path: polygon(100% 0, 100% 100%, 0 173.5px, 0 29px); clip-path: polygon(100% 0, 100% 100%, 0 173.5px, 0 29px); --pb1: 3.47; --pb2: 55deg; } .pole > div:nth-child(2) { width: 50px; height: 202.5px; transform: translate(-50%, -50%) rotateY(90deg) translateZ(25px); --pb1: 4.05; --pb2: 0deg; } .pole > div:nth-child(3) { width: 50px; height: 202.5px; transform: translate(-50%, -50%) rotateY(180deg) translateZ(25px); -webkit-clip-path: polygon(0 0, 0 100%, 100% 173.5px, 100% 29px); clip-path: polygon(0 0, 0 100%, 100% 173.5px, 100% 29px); --pb1: 3.47; --pb2: -55deg; } .pole > div:nth-child(4) { width: 50px; height: 144.5px; transform: translate(-50%, -50%) rotateY(270deg) translateZ(25px); --pb1: 2.89; --pb2: 0deg; } .neon { position: absolute; top: 85px; left: -150px; width: 100px; height: 100px; border: 2px solid var(--clr); transform: translate(-50%, -50%) rotateY(90deg) rotateX(120deg); transform-style: preserve-3d; -webkit.........完整代码请登录后点击上方下载按钮下载查看
网友评论0