canvas实现线条交汇背景效果代码
代码语言:html
所属分类:背景
代码描述:canvas实现线条交汇背景效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> canvas { width: 100vw; height: 100vh; background: #070025; position: fixed; top: 0; left: 0; } </style> </head> <body > <!-- hit the run button to draw a new snowflake--> <!-- best on desktop--> <!-- check out this awesome tutorial by Frank's Laboratory for a how-to https://www.youtube.com/watch?v=HXTC5LSep3M--> <canvas></canvas> <script > const canvas = document.querySelector("canvas"); const ctx = canvas.getContext("2d"); function setCanvasDimensions() { ctx.clearRect( canvas.width / 2, canvas.height / 2, canvas.width, canvas.height ); canvas.width = window.innerWidth; canvas.height = window.innerHeight; ctx.translate(canvas.width / 2, canvas.height / 2); } const colours = ["#FCD7A1", "#FFBED6", "#FF81CE", "#967FF2", "#4EE0D5"]; c.........完整代码请登录后点击上方下载按钮下载查看
网友评论0