js实现跟随鼠标的烟花尾巴绽放动画效果代码
代码语言:html
所属分类:动画
代码描述:js实现跟随鼠标的烟花尾巴绽放动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { background: #111; overflow: hidden; } #motionSimulation { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; } </style> </head> <body translate="no"> <svg id="motionSimulation" viewBox="0 0 200 100" preserveAspectRatio="none"> <circle id="getMe" r="0" fill="none"> <animateMotion dur="10s" repeatCount="indefinite" path="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" /> </circle> </svg> <script > let sparkInterval; function spark(event, opt_properties) { let mouseX, mouseY; if (event) { mouseX = event.clientX; mouseY = event.clientY; } const defaultProperties = { color: `rando.........完整代码请登录后点击上方下载按钮下载查看
网友评论0