canvas实现多彩渐变立体圆环晃动动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas实现多彩渐变立体圆环晃动动画效果代码
代码标签: canvas 多彩 渐变 立体 圆环 晃动 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html { overflow: hidden; } body { margin: 0; } </style> </head> <body > <canvas></canvas> <script> const canvas = document.querySelector("canvas"); const ctx = canvas.getContext("2d"); const width = window.innerWidth; const height = window.innerHeight; canvas.width = width; canvas.height = height; ctx.lineWidth = "3"; class Segment { constructor(context, color, size) { this.size = size; this.color = color; } update() { if (this.size > maxSize) { this.size = 0; } this.x = width / 2 + Math.sin(globalCount * 0.01) * 200; this.y = height / 2 + Math.cos(globalCount *.........完整代码请登录后点击上方下载按钮下载查看
网友评论0