Advertisement
Guest User

JS SUPERPOWER

a guest
Feb 12th, 2024
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.66 KB | Source Code | 0 0
  1. <canvas id="c" />
  2. <script>
  3.     b = document.body, a = c.getContext('2d');
  4.     document.body.clientWidth;
  5.     c.width = c.height = w = 410;
  6.     W = w / 2;
  7.     cx = cy = h = 99;
  8.     cp = Z = 0;
  9.     ca = .9;
  10.     hD = [];
  11.     d = [];
  12.     X = -20;
  13.     c.onmousemove = function(e) { X = e.clientX - W;
  14.         Y = e.clientY - W }
  15.     setInterval(function() {
  16.         cx += Math.cos(ca += X / w / 9);
  17.         cy += Math.sin(ca);
  18.         h += cp = h < 4 ? .1 : cp - Y / w / 9;
  19.         if (hD[(cx | 0) + (cy | 0) * w + W] / 7 > h) cp = 1;
  20.         for (x = w; x--;) {
  21.             L = w;
  22.             R = ca + Math.asin((x - W) / w);
  23.             for (y = 700; y > W; y--) {
  24.                 T = w * h / (y - W);
  25.                 tX = cx + T * Math.cos(R) | 0;
  26.                 tY = cy + T * Math.sin(R) | 0;
  27.                 i = tX < 0 || tY < 0 || tX > w || tY > w ? 0 : tX + tY * w + W;
  28.                 k = hD[i];
  29.                 o = k * 50 / T | 0;
  30.                 N = y - o < 0 ? 0 : y - o;
  31.                 if (N < L) {
  32.                     s = T / w;
  33.                     l = s > 1 ? 0 : U / s;
  34.                     for (o = L - N, L = N; o--;) {
  35.                         j = (x + N * w + o * w) * 4;
  36.                         D[j + 3] = l;
  37.                         D[j] = U;
  38.                         if (!k || o) { D[j] = k == U ? 99 : k && !(o % 9) ? U : d[i * 4];
  39.                             D[j + 1] = !k ? 99 : d[i * 4 + 1];
  40.                             D[j + 2] = i ? d[i * 4 + 2] : W;
  41.                             D[j + 3] = o && o < w / T && L > 1 ? U : i ? l += Math.cos(s) : Math.sin(R * T) > .8 ? l * .8 : l }
  42.                     }
  43.                 }
  44.             }
  45.         }
  46.         for (i = 3; i < w * w * 4; i += 4)
  47.             if (!D[i]) { D[i] = (w * w * 4 - i) / w / 9 * (i / 4 % w) / i * 3 * w;
  48.                 D[i - 1] = W;
  49.                 D[i - 2] = D[i - 3] = cx }
  50.         a.putImageData(I, 0, 0);
  51.         while (i--) D[i] = 0;
  52.         Z++;
  53.         Z %= w;
  54.         for (i = 9; i--;) { o = 5 + U * i + Z * w; if (Z < w - 1) hD[o] = 9;
  55.             hD[o - w] = 0 }
  56.     }, U = Y = 40)
  57.     for (i = w * w; i--;) {
  58.         x = i % w;
  59.         y = i / w;
  60.         z = y % U > 16 && x % U > 11 ? Math.abs(Math.cos(x / U | 0) / Math.cos(y / U | 0) * h) : 0;
  61.         hD[i] = z < U ? 0 : x % 74 > U && y % 75 > U ? z / ca : z;
  62.         d[i * 4] = d[i * 4 + 1] = d[i * 4 + 2] = (x - 3) % U < 4 || (y - 3) % U < 9 ? h : x % 8 < 2 || y % 9 < 2 ? 0 : Math.cos((x / 8 | 0) + (y / 9 | 0)) < ca ? hD[i] && x % W > h && y % W < h ? U + h : U : 0;
  63.         if ((x - 8) % U > 38 && (y - 2) % U > 38) hD[i + 1] = U
  64.     }
  65.     I = a.getImageData(0, 0, w, w);
  66.     D = I.data;
  67. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement