simplex-noise实现canvas等高线条变换动画效果代码
代码语言:html
所属分类:动画
代码描述:simplex-noise实现canvas等高线条变换动画效果代码,鼠标移动可实现不同的曲线图案。
代码标签: simplex-noise 曲线 等高线 变换 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body, html { margin: 0; } canvas { display: block; } .hide { display: none; } div { color: white; } </style> </head> <body> <canvas id="canvas"></canvas> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/simplex-noise.min.js"></script> <script> /* Johan Karlsson (DonKarlssonSan) 2018 */ let canvas; let ctx; let w, h; let m; let simplex; let mx, my; let now; function setup() { canvas = document.querySelector("#canvas"); ctx = canvas.getContext("2d"); reset(); window.addEventListener("resize", reset); canvas.addEventListener("mousemove", mousemove); } function reset() { simplex = new SimplexNoise(); w = canvas.width = window.innerWidth; h = canvas.height = window.innerHeight; m = Math.min(w, h); mx = w / 2; my = h / 2; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0