canvas绘制跟随鼠标移动的线条

在浏览网页时无意中发现了下面这种背景互动的效果: 通过一番周折,最终找到以下实现代码 function randomLine() { function n(n, e, t) { return n.getAttribute(e) || t } function e(n) { return document.getElementsByTagName(n) } function t() { var t = e("script"), o = t.length, i = t[o - 1]; return { l: o, z: n(i, "zIndex", -88), o: n(i, "opacity", .5), c: n(i, "color","0,0,0"), n: n(i, "count", 150) } } function o() { a = m.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, c = m....

Mar 20, 2022 · 3 min · Archai