js实现canvas艺术画作效果代码
代码语言:html
所属分类:布局界面
代码描述:js实现canvas艺术画作效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { overflow: hidden; } #canvas { position: absolute; top: 0; left: 0; background: black; } </style> </head> <body> <canvas id="canvas"></canvas> <script> const canvas = document.getElementById("canvas"); const ctx = canvas.getContext("2d"); canvas.width = window.innerWidth; canvas.height = window.innerHeight; let centerX = window.innerWidth / 2; let centerY = window.innerHeight / 2; function reportWindowSize() { canvas.width = window.innerWidth; canvas.height = window.innerHeight; let centerX = window.innerWidth / 2; let centerY = window.innerHeight / 2; } window.onresize = reportWindowSize; class Root { constructor(x, y, color, centerX, centerY) { this.x = x; this.y = y; this.color = color; this.speedX = 0; this.speedY = 0; this.centerX = cente.........完整代码请登录后点击上方下载按钮下载查看
网友评论0