canvas实现环面发射器动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas实现环面发射器动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> canvas { width: 98%; } body { background: black; } </style> </head> <body > <canvas id="canvas"></canvas> <script > const c = document.getElementById('canvas'); const x = c.getContext('2d'); const S = Math.sin,C = Math.cos,T = Math.tan,R = Math.random; c.width = window.innerWidth; c.height = window.innerHeight; x.translate(c.width / 2, 50); c.style.backgroundColor = 'black'; let coords = []; function draw(c, x, C, S, T, R, t) { x.fillStyle = '#00000001'; x.fillRect(-c.width, -c.height, c.width * 2, c.height * 2); let q = [],w = []; for (i = 0, r = 8, R = 8; i < .8; i = i + .01) { k = (R + r * S(i .........完整代码请登录后点击上方下载按钮下载查看
网友评论0