svg+css实现一个圆圈描边变成点跳动动画加载效果代码
代码语言:html
所属分类:动画
代码描述:svg+css实现一个圆圈描边变成点跳动动画加载效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --hue: 223; --bg: hsl(var(--hue),10%,90%); --fg: hsl(var(--hue),10%,10%); font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320)); } body { background: var(--bg); color: var(--fg); font: 1em/1.5 sans-serif; height: 100vh; display: grid; place-items: center; } .pl { display: block; width: 6.25em; height: 6.25em; } .pl__ring, .pl__ball { animation: ring 2s ease-out infinite; } .pl__ball { animation-name: ball; } /* Dark theme */ @media (prefers-color-scheme: dark) { :root { --bg: hsl(var(--hue),10%,10%); --fg: hsl(var(--hue),10%,90%); } } /* Animation */ @keyframes ring { from { stroke-dasharray: 0 257 0 0 1 0 0 258; } 25% { stroke-dasharray: 0 0 0 0 257 0 258 0; } 50%, to { stroke-dasharray: 0 0 0 0 0 515 0 0; } } @keyframes ball { from, 50% { animation-timing-function: ease-in; stroke-dashoffset: 1; } 64% { animation-timing-function: ease-in; stroke-dashoffset: -109; } 78% { animation-timing-function: ease-in; str.........完整代码请登录后点击上方下载按钮下载查看
网友评论0