div+css实现光圈球体线条动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现光圈球体线条动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --s: 4s; /*speed*/ --d: 40; /*delay*/ --c: #ff00e2; /*color*/ } * { transform-style: preserve-3d; box-sizing: border-box; } body { margin: 0; padding: 0; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; perspective: 1000vmin; background: radial-gradient(circle at 50% 100%, #101010, #000); } .sphere { width: 50vmin; height: 50vmin; background: #ffF0; position: relative; animation: spin 5s linear 0s infinite; animation-play-state: running; display: flex; align-items: center; justify-content: center; cursor: none; } .sphere:hover { animation-play-state: paused; } @keyframes spin { 0% { transform: rotateX(-210deg) rotateY(0deg) rotatez(185deg); } 100% { transform: rotateX(-210deg) rotateY(360deg) rotatez(185deg); } } .sphere div { --sz: 23%; --dv: calc(var(--s) / var(--d)); --dl: calc(var(--dv) * -1); width: var(--sz); height: var(--sz); position: absolute; border: 0.25vmin solid var(--c); border-radius: 100%; transform: rotateX(90deg) translateZ(24.5vmin); box-shadow: 0 0 0.5vmin 0.5vmin var(--c), 0 0 0.5vmin 0.5vmin var(--c) inset; animation: shine var(--s) linear var(--dl) infinite reverse; background: #fff0; display: flex; align-items: center; justify-content: center; } @keyframes shine { 33%, 100% { border-color: #10101000; box-shadow: 0 0 1px 1px #10101000, 0 0 1px 1px #10101000 inset; } } .sphere div:before { content: ""; width: 100%; height: 100%; position: absolute; border: 0.25vmin solid var(--c); border-radius: 100%; box-shadow: 0 0 0.5vmin 0.5vmin var(--c), 0 0 0.5vmin 0.5vmin var(--c) inset; animation: shine var(--s) linear calc(var(--dl) * -1) infinite reverse; } .sphere div:nth-child(2) { transform: rotateX(90deg) translateZ(22.5vmin); --sz: 43%; --dl: calc(var(--dv) * -2); filter: hue-rotate(-2deg); } .sphere div:nth-child(3) { transform: rotateX(90deg) translateZ(20vmin); --sz: 60%; --dl: calc(var(--dv) * -3); filter: hue-rotate(-4deg); } .sphere div:nth-child(4) { transform: rotateX(90deg) translateZ(17.5vmin); --sz: 71%; --dl: calc(var(--dv) * -4); filter: hue-rotate(-6deg); } .sphere div:nth-child(5) { transform: rotateX(90deg) translateZ(15vmin); --sz: 80%; --dl: calc(var(--dv) * -5); filter: hue-rotate(-8deg); } .sphere div:nth-child(6) { transform: rotateX(90deg) translateZ(12.5vmin); --sz: 86%; --dl: calc(var(--dv) * -6); filter: hue-rotate(-10deg); } .sphere div:nth-child(7) { transform: rotateX(90deg) translateZ(10vmin); --sz: 91%; --dl: calc(var(--dv) * -7); filter: hue-rotate(-12deg); } .sphere div:nth-child(8) { transform: rotateX(90deg) translateZ(7.5vmin); --sz: 95%; --dl: calc(var(--dv) * -8); filter: hue-rotate(-14deg); } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0