css实现三维陀螺仪门户宇宙中旋转动画效果代码
代码语言:html
所属分类:三维
代码描述:css实现三维陀螺仪门户宇宙中旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { transform: perspective(1000px); transform-style: preserve-3d; height: 100vh; display: grid; place-content: center; overflow: hidden; background-image: linear-gradient( to bottom right, rgba(27, 24, 31, 0.5) 21.2%, rgba(50, 4, 89, 0.5) 84.8% ), url(//repo.bfw.wiki/bfwrepo/image/621ffda954651.png); background-size: cover; background-position: center; } .ring { height: 70%; aspect-ratio: 1/1; transform-style: preserve-3d; position: relative; display: grid; place-items: center; transform: rotateX(var(--rx)) rotateY(var(--ry)); animation: rotationAnim var(--d, 5s) infinite linear; } .ring1 { height: 400px; } .ring.ring1 { --d: 6000ms; --rx: 0deg; --ry: 0deg; --rxTo: 0deg; --ryTo: 360deg; } .ring.ring2 { --d: 3500ms; --rx: 90deg; --ry: 0deg; --rxTo: 450deg; --ryTo: 0deg; } .ring.ring3 { --d: 1500ms; --rx: 0deg; --ry: 90deg; --rxTo: 0deg; --ryTo: 450deg; } @keyframes rotationAnim { to { transform: rotateX(var(--rxTo)) rotateY(var(--ryTo)); } } .ring > span { position: absolute; width: 100%; height: 100%; --borderWidth: 25px; top: 0; left: 0; transform: translateZ(calc(var(--depth) * 2px)); border: var(--borderWidth) solid var(--ringColor); border-radius: 50%; filter: drop-shadow(5px 5px rgba(0, 0, 0, 0.5)) drop-shadow(-2px -2px rgba(255, 255, 255, 0.1)); outline: 2px solid transparent; } .pin { position: absolute; height: 10px; width: 100%; background: var(--ringColor); clip-path: polygon( 0 0, 15% 0, 15% 100%, 85% 100%, 85% 0%, 100% 0, 100% 100%, 0% 100% ); box-shadow: inset 2px 2px 5px black; } .ring2 .pin { transform: rotate(90deg); } .center { width: 100px; top: calc(50% - 50px); left: calc(50% - 50px); aspect-ratio: 1/1; background: radial-gradient(black 50%, transparent 70%); border-radius: 50%; position: absolute; animation: center var(--d) linear infinite; filter: drop-shadow(0 0 20px darkblue) drop-shadow(0 0 10px black) drop-shadow(0 0 5px lightblue); } @keyframes center { to { transform: rotateY(-360deg); } } </style> </head&g.........完整代码请登录后点击上方下载按钮下载查看
网友评论0