canvas实现激光线条发射形成花托形状动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas实现激光线条发射形成花托形状动画效果代码
代码标签: 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 > /* eslint-disable prettier/prettier */ // canvas setup 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 = '#00000003'; 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) { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0