js+svg实现白条翻动loading加载动画效果代码
代码语言:html
所属分类:加载滚动
代码描述:js+svg实现白条翻动loading加载动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> * { margin: 0; padding: 0; } body { background: #111; text-align: center; } body, svg { max-height: 100vh; } :root { --len: 64; } * { margin: 0; padding: 0; } .anim { -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-name: grow; animation-name: grow; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; stroke-dasharray: 0 0 0 1000 10; } @-webkit-keyframes grow { 0% { stroke-dasharray: 0 0 0 1000 10; } 50% { stroke-dasharray: 0 0 var(--len) 1000 10; } 100% { stroke-dasharray: 0 var(--len) var(--len) 1000 10; } } @keyframes grow { 0% { stroke-dasharray: 0 0 0 1000 10; } 50% { stroke-dasharray: 0 0 var(--len) 1000 10; } 100% { stroke-dasharray: 0 var(--len) var(--len) 1000 10; } } </style> </head> <body> <svg viewBox="0 0 400 400" style="background:black"></svg> <script> const svg = document.querySelector("svg"); const html = new Array(10). fill(0). map((d, i) => { co.........完整代码请登录后点击上方下载按钮下载查看
网友评论0