Path: blob/main/libs/background/canvas-nest.js
1318 views
! function () {1var userAgentInfo = navigator.userAgent;2var Agents = ["iPad", "iPhone", "Android",3"SymbianOS", "Windows Phone",4"iPod", "webOS", "BlackBerry", "IEMobile"5];6for (var v = 0; v < Agents.length; v++) {7if (userAgentInfo.indexOf(Agents[v]) > 0) {8return;9}10}1112function o(w, v, i) {13return w.getAttribute(v) || i14}1516function j(i) {17return document.getElementsByTagName(i)18}1920function l() {21var i = j("script"),22w = i.length,23v = i[w - 1];24return {25l: w,26z: o(v, "zIndex", -1),27o: o(v, "opacity", 0.5),28c: o(v, "color", "0,0,0"),29n: o(v, "count", 99)30}31}3233function k() {34r = u.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, n = u.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight35}3637function b() {38e.clearRect(0, 0, r, n);39var w = [f].concat(t);40var x, v, A, B, z, y;41t.forEach(function (i) {42i.x += i.xa, i.y += i.ya, i.xa *= i.x > r || i.x < 0 ? -1 : 1, i.ya *= i.y > n || i.y < 0 ? -1 : 1, e.fillRect(i.x - 0.5, i.y - 0.5, 1, 1);43for (v = 0; v < w.length; v++) {44x = w[v];45if (i !== x && null !== x.x && null !== x.y) {46B = i.x - x.x, z = i.y - x.y, y = B * B + z * z;47y < x.max && (x === f && y >= x.max / 2 && (i.x -= 0.03 * B, i.y -= 0.03 * z), A = (x.max - y) / x.max, e.beginPath(), e.lineWidth = A / 2, e.strokeStyle = "rgba(" + s.c + "," + (A + 0.2) + ")", e.moveTo(i.x, i.y), e.lineTo(x.x, x.y), e.stroke())48}49}50w.splice(w.indexOf(i), 1)51}), m(b)52}53var u = document.createElement("canvas"),54s = l(),55c = "c_n" + s.l,56e = u.getContext("2d"),57r, n, m = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (i) {58window.setTimeout(i, 1000 / 45)59},60a = Math.random,61f = {62x: null,63y: null,64max: 2000065};66u.id = c;67u.style.cssText = "position:fixed;top:0;left:0;z-index:" + s.z + ";opacity:" + s.o;68j("body")[0].appendChild(u);69k(), window.onresize = k;70window.onmousemove = function (i) {71i = i || window.event, f.x = i.clientX, f.y = i.clientY72}, window.onmouseout = function () {73f.x = null, f.y = null74};75for (var t = [], p = 0; s.n > p; p++) {76var h = a() * r,77g = a() * n,78q = 2 * a() - 1,79d = 2 * a() - 1;80t.push({81x: h,82y: g,83xa: q,84ya: d,85max: 600086})87}88setTimeout(function () {89b()90}, 100)91}();929394