canvas绘制火山口效果代码
代码语言:html
所属分类:其他
代码描述:canvas绘制火山口效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> </head> <body translate="no"> <script > const canvas = document.createElement('canvas') const c = canvas.getContext('2d') document.body.style.margin = 0 document.body.style.overflow = 'hidden' canvas.width = innerWidth * 2 canvas.height = innerHeight * 2 document.body.append(canvas) canvas.style.width = innerWidth + 'px' canvas.style.height = innerHeight + 'px' c.fillStyle = 'rgba(108, 108, 108, 1)' c.fillRect(0, 0, canvas.width, canvas.height) function ring( t = 0, r = Math.min(innerWidth, innerHeight) * .4, noiz = Math.min(innerWidth, innerHeight) * .4, cx = innerWidth, cy = innerHeight, num = 100, height = 74, grad = 1.2, step = (Math.PI * 2) / num ) { let rads = [] for (let i = 0; i < num; i++) { rads.push(Math.random()) } for (let j = 0; j < height; j++) .........完整代码请登录后点击上方下载按钮下载查看
网友评论0