css+svg实现线圈圆圈旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:css+svg实现线圈圆圈旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { height: 100vh; margin: 0; display: grid; place-items: center; background:black; } svg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); height: 100%; width: 100%; } </style> </head> <body> <svg id="hurricane" viewBox="0 0 100 100"></svg> <script id="rendered-js" > function hurricane(svgElt, percentC, r, cx, cy, startAngle = 60) { startAngle = (startAngle * Math.PI) / 180; // convert to radians const angle = (percentC / 100) * (2 * Math.PI); const x = cx + r * Math.cos(startAngle + angle); const y = cy + r * Math.sin(startAngle + angle); const largeArc = percentC > 50 ? 1 : 0; let direction = randInt(0, 1) == 0 ? -1 : 1; let shade = `rg.........完整代码请登录后点击上方下载按钮下载查看
网友评论0