div+css实现太阳发射光芒漩涡式loading加载动画效果代码
代码语言:html
所属分类:加载滚动
代码描述:div+css实现太阳发射光芒漩涡式loading加载动画效果代码
代码标签: div css 太阳 发射 光芒 漩涡式 loading 加载 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --hue: 18; --bg: hsl(var(--hue),90%,90%); --fg: hsl(var(--hue),90%,10%); --primary: hsl(var(--hue),90%,50%); --trans-dur: 0.3s; font-size: calc(16px + (24 - 16) * (100vw - 320px) / (2560 - 320)); } body { background-color: var(--bg); color: var(--fg); display: flex; font: 1em/1.5 sans-serif; height: 100vh; transition: background-color var(--trans-dur), color var(--trans-dur); } .pl { margin: auto; width: 8em; height: 8em; } .pl__line, .pl__line-g, .pl__lines { animation: lineRotate 2s ease-in-out infinite; } .pl__line { animation-name: lineMove; animation-timing-function: ease-in; } .pl__line-g { animation-name: lineFade; animation-timing-function: linear; } .pl__line-g:nth-child(2), .pl__line-g:nth-child(2) .pl__line { animation-delay: 0.1666666667s; } .pl__line-g:nth-child(3), .pl__line-g:nth-child(3) .pl__line { animation-delay: 0.25s; } .pl__line-g:nth-child(4), .pl__line-g:nth-child(4) .pl__line { animation-delay: 0.3333333333s; } .pl__line-g:nth-child(5), .pl__line-g:nth-child(5) .pl__line { animation-delay: 0.4166666667s; } .pl__line-g:nth-child(6), .pl__line-g:nth-child(6) .pl__line { animation-delay: 0.5s; } .pl__line-g:nth-child(7), .pl__line-g:nth-child(7) .pl__line { animation-delay: 0.5833333333s; } .pl__line-g:nth-child(8), .pl__line-g:nth-child(8) .pl__line { animation-delay: 0.6666666667s; } .pl__line-g:nth-child(9), .pl__line-g:nth-child(9) .pl__line { animation-delay: 0.75s; } .pl__line-g:nth-child(10), .pl__line-g:nth-child(10) .pl__line { animation-delay: 0.8333333333s; } .pl__line-g:nth-child(11), .pl__line-g:nth-child(11) .pl__line { animation-delay: 0.9166666667s; } .pl__line-g:nth-child(12), .pl__line-g:nth-child(12) .pl__line { animation-delay: 1s; } .pl__lines { transform-origin: 64px 64px; } .pl__layer .pl__lines { stroke: #f2c40d; } .pl__layer + .pl__layer .pl__lines { stroke: #f2520d; } /* Dark theme */ @media (prefers-color-scheme: dark) { :root { --bg: hsl(var(--hue),90%,10%); --fg: hsl(var(--hue),90%,90%); } } /* Animations */ @keyframes lineRotate { from { transform: rotate(0); } to { transform: rotate(0.5turn); } } @keyframes lineFade { from, 50%, to { opacity: 0; } 10%, 45% { opacity: 1; } } @keyframes lineMove { from { stroke-dashoffset: -32; } 50%, to { stroke-dashoffset: 32; } } </style> </head> <body > <svg class="pl" viewBox="0 0 128 128" width="128px" height="128px"> <defs> <linearGradient id="pl-grad" x1="0" y1="0" x2="0" y2="1"> <stop offset="0%" stop-color="#000" /> <stop offset="100%" stop-color="#fff" /> </linearGradient> <mask id="pl-mask"> <rect x="0" y="0" width="128" height="128" fill="url(#pl-grad)" /> </mask> </defs> <g stroke-dasharray="32 32" stroke-dashoffset="-32" stroke-linecap="round" stroke-width="6"> <g class="pl__layer"> <g class="pl__lines" stroke="hsl(48,90%,50%)"> <g class="pl__line-g" transform="rotate(0,64,64) translate(0,-28)" > <polyline class="pl__line" points="64 32,64 64" /> </g> <g class="pl__line-g" transform="rotate(30,64,64) translate(0,-28)" > <polyline class="pl__line" points="64 32,64 64" /> </g> <g class="pl__line-g" transform="rotate(60,64,64) translate(0,-28)" > <polyline class="pl__line" points="64 32,64 64" /> </g> <g class="pl__line-g" transform="r.........完整代码请登录后点击上方下载按钮下载查看
网友评论0