Advertisement
stopfox

Untitled

Mar 18th, 2023
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. self.onmessage = function(t){var e,i,s,l,n,a,o,r,h,u,d,I,c,p,O,m,f,g,y,v,b,w,x,k;for(v=t.data.size,O=new O1IOI(t.data.seed),o=t.data.index,y=[],n=new Gradient,a=0;;){if(e=lIl0O.lI11l(O.next(),.75*O.next(),O.next()),n.add([a,e[0],e[1],e[2]]),a>=1)break;a+=.3*O.next()}for(c=new OIl0l(O.next()),l=2+3*O.next(),u=.5+.3*O.next(),s=O.next()<0?function(t,e,i,s){return c.turbulence2d(t,e,i,s)}:function(t,e,i,s){return c.l0l1l(t,e,i,s)},b=r=0,m=v-1;r<=m;b=r+=1)for(x=h=0,f=v-1;h<=f;x=h+=1)w=(b-.5*v)/v*2,k=(x-.5*v)/v*2,I=s(b/v*l,x/v*l,7,u)*Math.max(0,2*s(20+b/v*3,33+x/v*3,3,.6)-.5),i=Math.pow(Math.max(0,1-Math.sqrt(w*w+k*k)),2),e=n.getInt(I),e|=I*i*255<<24,y[b+x*v]=e;for(p=O.Il0lO(20),d=0,g=p;d<=g;d+=1)b=Math.floor(O.next()*v),x=Math.floor(O.next()*v),i=O.next(),e=16777215|Math.floor(255*i)<<24,y[b+x*v]=e;return self.postMessage({result:y,index:o})};var Gradient = (function() {
  2.   function Gradient(O1OIO) {
  3.     this.O1OIO = O1OIO;
  4.     if (this.O1OIO == null) {
  5.       this.O1OIO = [];
  6.     }
  7.   }
  8.  
  9.   Gradient.prototype.add = function(v) {
  10.     return this.O1OIO.push(v);
  11.   };
  12.  
  13.   Gradient.prototype.getInt = function(x) {
  14.     var a, b, index, O1000, v2;
  15.     if (this.O1OIO.length === 0) {
  16.       return 0;
  17.     }
  18.     O1000 = v2 = this.O1OIO[0];
  19.     if (x <= O1000[0]) {
  20.       return (O1000[1] << 16) | (O1000[2] << 8) | O1000[3];
  21.     }
  22.     index = 1;
  23.     while (true) {
  24.       if (x < v2[0] || index >= this.O1OIO.length - 1) {
  25.         break;
  26.       }
  27.       O1000 = v2;
  28.       v2 = this.O1OIO[index++];
  29.     }
  30.     if (x >= v2[0]) {
  31.       return (v2[1] << 16) | (v2[2] << 8) | v2[3];
  32.     } else {
  33.       b = (x - O1000[0]) / (v2[0] - O1000[0]);
  34.       a = (v2[0] - x) / (v2[0] - O1000[0]);
  35.       return ((a * O1000[1] + b * v2[1]) << 16) | ((a * O1000[2] + b * v2[2]) << 8) | ((a * O1000[3] + b * v2[3]) | 0);
  36.     }
  37.   };
  38.  
  39.   Gradient.prototype.get = function(x) {
  40.     var a, b, index, O1000, v2;
  41.     if (this.O1OIO.length === 0) {
  42.       return [0, 0, 0];
  43.     }
  44.     O1000 = v2 = this.O1OIO[0];
  45.     if (x <= O1000[0]) {
  46.       return [O1000[1], O1000[2], O1000[3]];
  47.     }
  48.     index = 1;
  49.     while (true) {
  50.       if (x < v2[0] || index >= this.O1OIO.length - 1) {
  51.         break;
  52.       }
  53.       O1000 = v2;
  54.       v2 = this.O1OIO[index++];
  55.     }
  56.     if (x >= v2[0]) {
  57.       return [v2[1], v2[2], v2[3]];
  58.     } else {
  59.       b = (x - O1000[0]) / (v2[0] - O1000[0]);
  60.       a = (v2[0] - x) / (v2[0] - O1000[0]);
  61.       return [a * O1000[1] + b * v2[1], a * O1000[2] + b * v2[2], a * O1000[3] + b * v2[3]];
  62.     }
  63.   };
  64.  
  65.   return Gradient;
  66.  
  67. })();
  68.  
  69. var lIl0O = (function() {
  70.   function lIl0O() {}
  71.  
  72.   lIl0O.lI11l = function(h, s, v, OOI1l) {
  73.     var b, f, g, i, p, q, r, t;
  74.     if (OOI1l == null) {
  75.       OOI1l = [];
  76.     }
  77.     i = Math.floor(h * 6);
  78.     f = h * 6 - i;
  79.     p = v * (1 - s);
  80.     q = v * (1 - f * s);
  81.     t = v * (1 - (1 - f) * s);
  82.     switch (i % 6) {
  83.       case 0:
  84.         r = v;
  85.         g = t;
  86.         b = p;
  87.         break;
  88.       case 1:
  89.         r = q;
  90.         g = v;
  91.         b = p;
  92.         break;
  93.       case 2:
  94.         r = p;
  95.         g = v;
  96.         b = t;
  97.         break;
  98.       case 3:
  99.         r = p;
  100.         g = q;
  101.         b = v;
  102.         break;
  103.       case 4:
  104.         r = t;
  105.         g = p;
  106.         b = v;
  107.         break;
  108.       case 5:
  109.         r = v;
  110.         g = p;
  111.         b = q;
  112.     }
  113.     OOI1l[0] = (r * 255) | 0;
  114.     OOI1l[1] = (g * 255) | 0;
  115.     OOI1l[2] = (b * 255) | 0;
  116.     return OOI1l;
  117.   };
  118.  
  119.   lIl0O.hsvToRgbHex = function(h, s, v) {
  120.     var b, f, g, i, p, q, r, t;
  121.     i = Math.floor(h * 6);
  122.     f = h * 6 - i;
  123.     p = v * (1 - s);
  124.     q = v * (1 - f * s);
  125.     t = v * (1 - (1 - f) * s);
  126.     switch (i % 6) {
  127.       case 0:
  128.         r = v;
  129.         g = t;
  130.         b = p;
  131.         break;
  132.       case 1:
  133.         r = q;
  134.         g = v;
  135.         b = p;
  136.         break;
  137.       case 2:
  138.         r = p;
  139.         g = v;
  140.         b = t;
  141.         break;
  142.       case 3:
  143.         r = p;
  144.         g = q;
  145.         b = v;
  146.         break;
  147.       case 4:
  148.         r = t;
  149.         g = p;
  150.         b = v;
  151.         break;
  152.       case 5:
  153.         r = v;
  154.         g = p;
  155.         b = q;
  156.     }
  157.     return (((r * 255) | 0) << 16) | (((g * 255) | 0) << 8) | ((b * 255) | 0);
  158.   };
  159.  
  160.   return lIl0O;
  161.  
  162. })();
  163.  
  164. var O1IOI = (function() {
  165.   function O1IOI(seed) {
  166.     this.seed = seed != null ? seed : Math.random();
  167.     if (this.seed < 1) {
  168.       this.seed *= 1 << 30;
  169.     }
  170.     this.a = 13971;
  171.     this.b = 12345;
  172.     this.size = 1 << 30;
  173.     this.lOO11 = this.size - 1;
  174.     this.l01OI = 1 / this.size;
  175.     this.llI0O();
  176.     this.llI0O();
  177.     this.llI0O();
  178.   }
  179.  
  180.   O1IOI.prototype.next = function() {
  181.     this.seed = (this.seed * this.a + this.b) & this.lOO11;
  182.     return this.seed * this.l01OI;
  183.   };
  184.  
  185.   O1IOI.prototype.Il0lO = function(O1O01, pow) {
  186.     if (pow != null) {
  187.       return Math.floor(Math.pow(this.next(), pow) * O1O01);
  188.     } else {
  189.       return Math.floor(this.next() * O1O01);
  190.     }
  191.   };
  192.  
  193.   O1IOI.prototype.llI0O = function() {
  194.     return this.seed = (this.seed * this.a + this.b) & this.lOO11;
  195.   };
  196.  
  197.   O1IOI.prototype.feed = function(number) {
  198.     return this.seed = (this.seed * this.a * number + this.b) & this.lOO11;
  199.   };
  200.  
  201.   return O1IOI;
  202.  
  203. })();
  204.  
  205. var OIl0l = (function() {
  206.   function OIl0l(l1I01) {
  207.     var i, l, len, ref;
  208.     this.seed = l1I01;
  209.     this.table = [670, 243, 963, 607, 432, 29, 624, 809, 254, 752, 691, 904, 275, 984, 586, 94, 1014, 614, 252, 178, 488, 954, 55, 836, 186, 858, 719, 562, 685, 898, 167, 844, 639, 505, 85, 386, 520, 988, 561, 889, 91, 329, 900, 847, 334, 531, 168, 57, 789, 529, 259, 323, 313, 72, 153, 606, 694, 442, 547, 922, 242, 983, 965, 876, 39, 728, 383, 109, 343, 810, 815, 144, 457, 434, 221, 279, 328, 136, 674, 556, 502, 896, 582, 250, 665, 370, 926, 912, 118, 543, 365, 467, 311, 700, 15, 297, 609, 731, 476, 634, 715, 777, 62, 1007, 525, 942, 310, 627, 630, 448, 437, 822, 300, 339, 924, 583, 92, 800, 698, 312, 542, 740, 271, 778, 895, 447, 175, 957, 17, 481, 347, 283, 366, 277, 843, 966, 927, 535, 503, 234, 746, 712, 1010, 544, 671, 295, 978, 729, 997, 287, 621, 782, 160, 433, 537, 121, 413, 304, 98, 657, 498, 946, 319, 595, 191, 341, 554, 523, 274, 209, 435, 644, 947, 979, 397, 261, 681, 786, 1006, 565, 472, 180, 318, 126, 874, 693, 526, 276, 340, 808, 884, 409, 486, 962, 960, 772, 901, 690, 359, 837, 129, 363, 509, 616, 88, 382, 730, 513, 623, 999, 504, 48, 4, 384, 281, 560, 417, 99, 773, 956, 943, 496, 558, 218, 170, 471, 536, 138, 19, 266, 6, 868, 845, 16, 985, 866, 601, 445, 458, 894, 950, 349, 1017, 125, 495, 723, 446, 647, 834, 880, 272, 475, 483, 227, 357, 750, 851, 139, 406, 336, 158, 284, 482, 324, 991, 632, 587, 663, 74, 256, 541, 120, 801, 831, 46, 522, 589, 1, 571, 368, 137, 761, 885, 968, 982, 948, 785, 391, 840, 932, 829, 117, 641, 466, 367, 688, 733, 229, 735, 14, 205, 31, 316, 333, 183, 521, 795, 58, 1021, 282, 794, 939, 40, 394, 793, 1002, 763, 212, 484, 133, 260, 465, 396, 769, 518, 955, 497, 377, 145, 508, 514, 224, 196, 454, 176, 975, 865, 1005, 1023, 986, 596, 426, 893, 551, 90, 130, 873, 22, 709, 686, 436, 236, 661, 579, 764, 362, 141, 112, 970, 987, 12, 317, 369, 26, 344, 66, 803, 493, 716, 9, 637, 945, 225, 703, 78, 346, 751, 123, 1009, 1016, 27, 52, 864, 902, 921, 292, 314, 599, 799, 263, 626, 338, 953, 491, 892, 353, 692, 917, 540, 882, 677, 744, 633, 821, 327, 60, 1020, 928, 788, 360, 414, 430, 462, 824, 820, 727, 398, 342, 273, 726, 981, 84, 82, 206, 388, 720, 806, 652, 550, 238, 159, 134, 732, 897, 500, 881, 805, 814, 701, 717, 566, 7, 211, 604, 816, 56, 658, 107, 61, 374, 320, 501, 13, 642, 863, 791, 438, 348, 97, 214, 86, 305, 875, 656, 24, 364, 767, 156, 879, 590, 734, 920, 655, 577, 83, 584, 660, 38, 100, 299, 580, 990, 636, 944, 463, 766, 996, 714, 8, 515, 87, 198, 280, 444, 131, 404, 108, 278, 487, 223, 598, 410, 395, 199, 268, 989, 75, 195, 760, 916, 977, 421, 11, 1000, 813, 216, 817, 823, 164, 668, 739, 572, 30, 707, 798, 291, 564, 77, 456, 478, 68, 643, 615, 172, 841, 672, 919, 1012, 613, 385, 980, 711, 771, 682, 232, 765, 143, 620, 631, 861, 468, 622, 201, 325, 424, 189, 608, 403, 775, 646, 673, 1013, 400, 859, 838, 345, 210, 860, 65, 63, 34, 755, 161, 479, 235, 783, 460, 826, 507, 854, 839, 666, 802, 441, 114, 443, 738, 770, 929, 857, 907, 741, 935, 949, 322, 995, 217, 667, 269, 184, 650, 1018, 506, 290, 787, 459, 721, 828, 567, 222, 494, 142, 743, 405, 76, 722, 588, 147, 899, 270, 695, 597, 337, 155, 569, 679, 853, 450, 21, 517, 197, 371, 257, 380, 244, 553, 952, 381, 827, 524, 877, 702, 306, 600, 1011, 431, 781, 594, 387, 1019, 411, 533, 659, 177, 725, 930, 933, 832, 41, 2, 687, 1008, 439, 307, 891, 871, 415, 651, 308, 298, 811, 0, 194, 592, 241, 918, 18, 973, 110, 654, 967, 490, 683, 914, 128, 992, 964, 122, 230, 149, 289, 392, 416, 852, 936, 262, 102, 938, 511, 255, 510, 165, 105, 419, 958, 294, 379, 49, 699, 330, 593, 539, 710, 106, 79, 440, 200, 704, 961, 326, 321, 759, 193, 890, 44, 549, 913, 776, 909, 552, 972, 132, 429, 748, 532, 115, 888, 635, 842, 649, 747, 807, 887, 856, 784, 148, 530, 116, 157, 372, 754, 28, 581, 67, 187, 202, 818, 181, 45, 959, 146, 124, 994, 872, 675, 706, 253, 247, 625, 570, 152, 423, 185, 361, 849, 971, 546, 412, 830, 1022, 188, 850, 140, 220, 451, 219, 768, 1015, 455, 780, 976, 449, 969, 848, 293, 249, 59, 390, 512, 538, 578, 906, 819, 862, 974, 33, 911, 135, 908, 248, 401, 951, 527, 169, 676, 640, 1003, 591, 103, 37, 285, 684, 104, 163, 753, 1004, 934, 645, 470, 774, 20, 489, 228, 461, 492, 469, 998, 296, 233, 869, 605, 315, 36, 5, 425, 878, 617, 886, 23, 355, 993, 93, 473, 555, 474, 464, 937, 925, 1001, 611, 35, 812, 174, 53, 286, 680, 267, 428, 335, 883, 653, 69, 718, 585, 749, 150, 408, 393, 915, 576, 664, 629, 756, 402, 638, 602, 245, 43, 545, 213, 303, 192, 70, 453, 910, 407, 742, 111, 548, 835, 452, 575, 903, 619, 376, 154, 302, 151, 804, 867, 574, 563, 239, 648, 179, 855, 378, 618, 264, 669, 427, 354, 399, 265, 50, 796, 166, 923, 825, 697, 534, 54, 173, 870, 792, 162, 713, 246, 89, 51, 350, 705, 251, 557, 237, 240, 736, 689, 203, 519, 73, 81, 628, 288, 331, 204, 528, 480, 389, 32, 418, 573, 757, 358, 215, 226, 42, 779, 231, 171, 190, 612, 301, 762, 708, 420, 846, 208, 485, 351, 790, 737, 10, 258, 309, 797, 127, 516, 559, 499, 352, 71, 758, 25, 568, 113, 3, 610, 101, 375, 96, 603, 745, 64, 80, 477, 332, 833, 940, 373, 905, 422, 182, 356, 941, 47, 119, 662, 931, 696, 95, 724, 678, 207];
  210.     len = this.table.length;
  211.     for (i = l = 0, ref = len - 1; 0 <= ref ? l <= ref : l >= ref; i = 0 <= ref ? ++l : --l) {
  212.       this.table.push(this.table[i]);
  213.     }
  214.     if (this.seed < 1) {
  215.       this.seed *= 1 << 30;
  216.     }
  217.     this.size = 1024;
  218.     this.normalize = 1 / 1023;
  219.     this.lOO11 = 1023;
  220.     this.I1I00 = this.seed & this.lOO11;
  221.     this.OIII1 = (this.seed >> 10) & this.lOO11;
  222.     this.I11I0 = (this.seed >> 20) & this.lOO11;
  223.     this.c2d = [];
  224.     this.I0lOl = Math.cos(.3);
  225.     this.IlIOO = Math.sin(.3);
  226.   }
  227.  
  228.   OIl0l.prototype.I0000 = function(x, y, a) {
  229.     var c;
  230.     c = (-2 * a + 3) * a * a;
  231.     return x * (1 - c) + y * c;
  232.   };
  233.  
  234.   OIl0l.prototype.I10OI = function(x, y, a) {
  235.     return x * (1 - a) + y * a;
  236.   };
  237.  
  238.   OIl0l.prototype.lO001 = function(x, y) {
  239.     var l1lIl, II10I, O1000, v2, O1lll, OIlOI, I1OOl, OOIO0;
  240.     I1OOl = Math.floor(x);
  241.     OOIO0 = Math.floor(y);
  242.     l1lIl = x - I1OOl;
  243.     II10I = y - OOIO0;
  244.     I1OOl = I1OOl & this.lOO11;
  245.     OOIO0 = OOIO0 & this.lOO11;
  246.     O1000 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.OIII1]]];
  247.     v2 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.OIII1]]];
  248.     O1lll = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.OIII1]]];
  249.     OIlOI = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.OIII1]]];
  250.     return this.I0000(this.I0000(O1000, v2, l1lIl), this.I0000(O1lll, OIlOI, l1lIl), II10I) * this.normalize;
  251.   };
  252.  
  253.   OIl0l.prototype.l0lOl = function(x, y, z) {
  254.     var l1lIl, II10I, az, O1000, v2, O1lll, OIlOI, lIIIO, O1lI1, l0IO1, OIl0I, l1110, Ol1lI, I1OOl, OOIO0, OOl0l;
  255.     I1OOl = Math.floor(x);
  256.     OOIO0 = Math.floor(y);
  257.     OOl0l = Math.floor(z);
  258.     l1lIl = x - I1OOl;
  259.     II10I = y - OOIO0;
  260.     az = z - OOl0l;
  261.     I1OOl = I1OOl & this.lOO11;
  262.     OOIO0 = OOIO0 & this.lOO11;
  263.     OOl0l = OOl0l & this.lOO11;
  264.     O1000 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  265.     v2 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  266.     O1lll = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  267.     OIlOI = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  268.     lIIIO = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  269.     O1lI1 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  270.     l0IO1 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  271.     OIl0I = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  272.     l1110 = this.I0000(this.I0000(O1000, v2, l1lIl), this.I0000(O1lll, OIlOI, l1lIl), II10I);
  273.     Ol1lI = this.I0000(this.I0000(lIIIO, O1lI1, l1lIl), this.I0000(l0IO1, OIl0I, l1lIl), II10I);
  274.     return this.I0000(l1110, Ol1lI, az) * this.normalize;
  275.   };
  276.  
  277.   OIl0l.prototype.I1OII = function(x, y, z) {
  278.     var l1lIl, II10I, az, O1000, v2, O1lll, OIlOI, lIIIO, O1lI1, l0IO1, OIl0I, l1110, Ol1lI, I1OOl, OOIO0, OOl0l;
  279.     I1OOl = Math.floor(x);
  280.     OOIO0 = Math.floor(y);
  281.     OOl0l = Math.floor(z);
  282.     l1lIl = x - I1OOl;
  283.     II10I = y - OOIO0;
  284.     az = z - OOl0l;
  285.     I1OOl = I1OOl & this.lOO11;
  286.     OOIO0 = OOIO0 & this.lOO11;
  287.     OOl0l = OOl0l & this.lOO11;
  288.     O1000 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  289.     v2 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  290.     O1lll = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  291.     OIlOI = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
  292.     lIIIO = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  293.     O1lI1 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  294.     l0IO1 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  295.     OIl0I = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
  296.     l1110 = this.I10OI(this.I10OI(O1000, v2, l1lIl), this.I10OI(O1lll, OIlOI, l1lIl), II10I);
  297.     Ol1lI = this.I10OI(this.I10OI(lIIIO, O1lI1, l1lIl), this.I10OI(l0IO1, OIl0I, l1lIl), II10I);
  298.     return this.I10OI(l1110, Ol1lI, az) * this.normalize;
  299.   };
  300.  
  301.   OIl0l.prototype.OIOO0 = function(lO1O1, I11l0, iz) {};
  302.  
  303.   OIl0l.prototype.l0l1l = function(x, y, OlI10, O001l, lllO0, lOOOO, ts) {
  304.     var d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O;
  305.     if (OlI10 == null) {
  306.       OlI10 = 5;
  307.     }
  308.     if (O001l == null) {
  309.       O001l = .5;
  310.     }
  311.     if (lllO0 == null) {
  312.       lllO0 = 1.9;
  313.     }
  314.     if (lOOOO == null) {
  315.       lOOOO = this.I0lOl;
  316.     }
  317.     if (ts == null) {
  318.       ts = this.IlIOO;
  319.     }
  320.     I0l1O = 0;
  321.     d = 1;
  322.     l01OI = 0;
  323.     for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
  324.       I0l1O += this.lO001(x, y) * d;
  325.       l01OI += d;
  326.       d *= O001l;
  327.       O0IOl = lllO0 * (x * lOOOO + y * ts);
  328.       OlII0 = lllO0 * (y * lOOOO - x * ts);
  329.       x = O0IOl;
  330.       y = OlII0;
  331.     }
  332.     return I0l1O / l01OI;
  333.   };
  334.  
  335.   OIl0l.prototype.Il0I1 = function(x, y, z, OlI10, O001l, lllO0, lOOOO, ts) {
  336.     var d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O;
  337.     if (OlI10 == null) {
  338.       OlI10 = 5;
  339.     }
  340.     if (O001l == null) {
  341.       O001l = .5;
  342.     }
  343.     if (lllO0 == null) {
  344.       lllO0 = 1.9;
  345.     }
  346.     if (lOOOO == null) {
  347.       lOOOO = this.I0lOl;
  348.     }
  349.     if (ts == null) {
  350.       ts = this.IlIOO;
  351.     }
  352.     I0l1O = 0;
  353.     d = 1;
  354.     l01OI = 0;
  355.     for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
  356.       I0l1O += this.l0lOl(x, y, z) * d;
  357.       l01OI += d;
  358.       d *= O001l;
  359.       O0IOl = lllO0 * (x * lOOOO + y * ts);
  360.       OlII0 = lllO0 * (y * lOOOO - x * ts);
  361.       x = O0IOl;
  362.       y = OlII0;
  363.       z = lllO0 * z;
  364.     }
  365.     return I0l1O / l01OI;
  366.   };
  367.  
  368.   OIl0l.prototype.O1l11 = function(x, y, lO000, OlI10, O001l, lllO0, lOOOO, ts) {
  369.     var l1lIl, II10I, lO1O1, I11l0, O1000, v2, O1lll, OIlOI;
  370.     if (OlI10 == null) {
  371.       OlI10 = 5;
  372.     }
  373.     if (O001l == null) {
  374.       O001l = .5;
  375.     }
  376.     if (lllO0 == null) {
  377.       lllO0 = 1.9;
  378.     }
  379.     if (lOOOO == null) {
  380.       lOOOO = this.I0lOl;
  381.     }
  382.     if (ts == null) {
  383.       ts = this.IlIOO;
  384.     }
  385.     lO1O1 = Math.floor(x / lO000);
  386.     I11l0 = Math.floor(y / lO000);
  387.     l1lIl = x / lO000 - lO1O1;
  388.     II10I = y / lO000 - I11l0;
  389.     O1000 = this.l0l1l(l1lIl * lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
  390.     v2 = this.l0l1l(l1lIl * lO000 + lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
  391.     O1lll = this.l0l1l(l1lIl * lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
  392.     OIlOI = this.l0l1l(l1lIl * lO000 + lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
  393.     return this.I0000(this.I0000(O1000, v2, 1 - l1lIl), this.I0000(O1lll, OIlOI, 1 - l1lIl), 1 - II10I);
  394.   };
  395.  
  396.   OIl0l.prototype.turbulence2d = function(x, y, OlI10, O001l, lllO0, lOOOO, ts) {
  397.     var d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O;
  398.     if (OlI10 == null) {
  399.       OlI10 = 5;
  400.     }
  401.     if (O001l == null) {
  402.       O001l = .5;
  403.     }
  404.     if (lllO0 == null) {
  405.       lllO0 = 1.9;
  406.     }
  407.     if (lOOOO == null) {
  408.       lOOOO = this.I0lOl;
  409.     }
  410.     if (ts == null) {
  411.       ts = this.IlIOO;
  412.     }
  413.     I0l1O = 0;
  414.     d = 1;
  415.     l01OI = 0;
  416.     for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
  417.       I0l1O += 2 * (.5 - Math.abs(.5 - this.lO001(x, y))) * d;
  418.       l01OI += d;
  419.       d *= O001l;
  420.       O0IOl = lllO0 * (x * lOOOO + y * ts);
  421.       OlII0 = lllO0 * (y * lOOOO - x * ts);
  422.       x = O0IOl;
  423.       y = OlII0;
  424.     }
  425.     return I0l1O / l01OI;
  426.   };
  427.  
  428.   OIl0l.prototype.periodicTurbulence2d = function(x, y, lO000, OlI10, O001l, lllO0, lOOOO, ts) {
  429.     var l1lIl, II10I, lO1O1, I11l0, O1000, v2, O1lll, OIlOI;
  430.     if (OlI10 == null) {
  431.       OlI10 = 5;
  432.     }
  433.     if (O001l == null) {
  434.       O001l = .5;
  435.     }
  436.     if (lllO0 == null) {
  437.       lllO0 = 1.9;
  438.     }
  439.     if (lOOOO == null) {
  440.       lOOOO = this.I0lOl;
  441.     }
  442.     if (ts == null) {
  443.       ts = this.IlIOO;
  444.     }
  445.     lO1O1 = Math.floor(x / lO000);
  446.     I11l0 = Math.floor(y / lO000);
  447.     l1lIl = x / lO000 - lO1O1;
  448.     II10I = y / lO000 - I11l0;
  449.     O1000 = this.turbulence2d(l1lIl * lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
  450.     v2 = this.turbulence2d(l1lIl * lO000 + lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
  451.     O1lll = this.turbulence2d(l1lIl * lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
  452.     OIlOI = this.turbulence2d(l1lIl * lO000 + lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
  453.     return this.I0000(this.I0000(O1000, v2, 1 - l1lIl), this.I0000(O1lll, OIlOI, 1 - l1lIl), 1 - II10I);
  454.   };
  455.  
  456.   OIl0l.prototype.OOIIl = function(x, y, OlI10, O001l, lllO0, lOOOO, ts) {
  457.     var Ol11I, d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O, v;
  458.     if (OlI10 == null) {
  459.       OlI10 = 5;
  460.     }
  461.     if (O001l == null) {
  462.       O001l = .5;
  463.     }
  464.     if (lllO0 == null) {
  465.       lllO0 = 1.9;
  466.     }
  467.     if (lOOOO == null) {
  468.       lOOOO = this.I0lOl;
  469.     }
  470.     if (ts == null) {
  471.       ts = this.IlIOO;
  472.     }
  473.     I0l1O = 0;
  474.     Ol11I = 1;
  475.     d = 1;
  476.     l01OI = 0;
  477.     for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
  478.       v = this.lO001(x, y) * 2;
  479.       if (v > 1) {
  480.         v = 2 - v;
  481.       }
  482.       v = Math.pow(v, 2);
  483.       I0l1O += Ol11I * d * v;
  484.       Ol11I = v;
  485.       l01OI += d;
  486.       d *= O001l;
  487.       O0IOl = lllO0 * (x * lOOOO + y * ts);
  488.       OlII0 = lllO0 * (y * lOOOO - x * ts);
  489.       x = O0IOl;
  490.       y = OlII0;
  491.     }
  492.     return I0l1O / l01OI;
  493.   };
  494.  
  495.   OIl0l.prototype.IOIlI = function(x, y, z, OlI10, O001l, lllO0, lOOOO, ts) {
  496.     var Ol11I, d, i, l, lIO0l, l01OI, O0IOl, OlII0, I0I0l, ref, I0l1O, v;
  497.     if (OlI10 == null) {
  498.       OlI10 = 5;
  499.     }
  500.     if (O001l == null) {
  501.       O001l = .5;
  502.     }
  503.     if (lllO0 == null) {
  504.       lllO0 = 1.9;
  505.     }
  506.     if (lOOOO == null) {
  507.       lOOOO = this.I0lOl;
  508.     }
  509.     if (ts == null) {
  510.       ts = this.IlIOO;
  511.     }
  512.     I0l1O = 0;
  513.     Ol11I = 1;
  514.     d = 1;
  515.     l01OI = 0;
  516.     for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
  517.       v = this.l0lOl(x, y, z) * 2;
  518.       if (v > 1) {
  519.         v = 2 - v;
  520.       }
  521.       v = Math.pow(v, 2);
  522.       I0l1O += Ol11I * d * v;
  523.       Ol11I = v;
  524.       l01OI += d;
  525.       d *= O001l;
  526.       O0IOl = x * lOOOO + y * ts;
  527.       OlII0 = y * lOOOO - x * ts;
  528.       lIO0l = OlII0 * lOOOO + z * ts;
  529.       I0I0l = z * lOOOO - OlII0 * ts;
  530.       x = lllO0 * O0IOl;
  531.       y = lllO0 * lIO0l;
  532.       z = lllO0 * I0I0l;
  533.     }
  534.     return I0l1O / l01OI;
  535.   };
  536.  
  537.   OIl0l.prototype.IlI0I = function(x, y, lO000) {
  538.     var l1lIl, II10I, I00II, lI01I, IO0Il, lO00O, IIOl0, I1O10, d, d1, d2, lOO00, IIOlI, O1O0l, OlIl1, l1l10, ll0OI, i, j, l, m, px, OOIII, I1OOl, I00ll, OOIO0, IIlO1;
  539.     I1OOl = Math.floor(x);
  540.     OOIO0 = Math.floor(y);
  541.     l1lIl = x - I1OOl;
  542.     II10I = y - OOIO0;
  543.     I00II = 100;
  544.     lI01I = 0;
  545.     IO0Il = 0;
  546.     lO00O = 100;
  547.     IIOl0 = 0;
  548.     I1O10 = 0;
  549.     for (i = l = 0; l <= 2; i = l += 1) {
  550.       for (j = m = 0; m <= 2; j = m += 1) {
  551.         I00ll = (I1OOl - 1 + i) % lO000;
  552.         IIlO1 = (OOIO0 - 1 + j) % lO000;
  553.         px = -1 + i + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + IIlO1]]] * this.normalize * .8 + .1;
  554.         OOIII = -1 + j + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IIlO1 + 1]]]] * this.normalize * .8 + .1;
  555.         lOO00 = l1lIl - px;
  556.         OlIl1 = II10I - OOIII;
  557.         d = lOO00 * lOO00 + OlIl1 * OlIl1;
  558.         if (d < I00II) {
  559.           lO00O = I00II;
  560.           IIOl0 = lI01I;
  561.           I1O10 = IO0Il;
  562.           I00II = d;
  563.           lI01I = px;
  564.           IO0Il = OOIII;
  565.         } else if (d < lO00O) {
  566.           lO00O = d;
  567.           IIOl0 = px;
  568.           I1O10 = OOIII;
  569.         }
  570.       }
  571.     }
  572.     IIOlI = l1lIl - lI01I;
  573.     l1l10 = II10I - IO0Il;
  574.     d1 = Math.sqrt(IIOlI * IIOlI + l1l10 * l1l10);
  575.     O1O0l = l1lIl - IIOl0;
  576.     ll0OI = II10I - I1O10;
  577.     d2 = Math.sqrt(O1O0l * O1O0l + ll0OI * ll0OI);
  578.     return Math.min(d1, d2) / Math.max(d1, d2);
  579.   };
  580.  
  581.   OIl0l.prototype.ll0I0 = function(x, y, lO000) {
  582.     var l1lIl, II10I, I00II, lI01I, IO0Il, OI01I, d, lOO00, OlIl1, i, j, l, m, px, OOIII, seed, I1OOl, I00ll, OOIO0, IIlO1;
  583.     I1OOl = Math.floor(x);
  584.     OOIO0 = Math.floor(y);
  585.     l1lIl = x - I1OOl;
  586.     II10I = y - OOIO0;
  587.     I00II = 100;
  588.     lI01I = 0;
  589.     IO0Il = 0;
  590.     OI01I = 0;
  591.     for (i = l = 0; l <= 2; i = l += 1) {
  592.       for (j = m = 0; m <= 2; j = m += 1) {
  593.         I00ll = (I1OOl - 1 + i) % lO000;
  594.         IIlO1 = (OOIO0 - 1 + j) % lO000;
  595.         px = -1 + i + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + IIlO1]]] * this.normalize * .8 + .1;
  596.         OOIII = -1 + j + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IIlO1 + 1]]]] * this.normalize * .8 + .1;
  597.         seed = this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IIlO1 + 17]]]];
  598.         lOO00 = l1lIl - px;
  599.         OlIl1 = II10I - OOIII;
  600.         d = lOO00 * lOO00 + OlIl1 * OlIl1;
  601.         if (d < I00II) {
  602.           I00II = d;
  603.           lI01I = px;
  604.           IO0Il = OOIII;
  605.           OI01I = seed;
  606.         }
  607.       }
  608.     }
  609.     return OI01I * this.normalize;
  610.   };
  611.  
  612.   OIl0l.prototype.Oll10 = function(x, y, z, lO000) {
  613.     var l1lIl, II10I, az, I00II, lI01I, IO0Il, l11OI, lO00O, IIOl0, I1O10, O0I11, d, d1, d2, lOO00, IIOlI, O1O0l, OlIl1, l1l10, ll0OI, OlI0l, ll1ll, O0l1l, i, j, k, l, m, n, px, OOIII, IllI0, I1OOl, I00ll, OOIO0, IIlO1, OOl0l, IlI1O;
  614.     if (lO000 == null) {
  615.       lO000 = 100;
  616.     }
  617.     I1OOl = Math.floor(x);
  618.     OOIO0 = Math.floor(y);
  619.     OOl0l = Math.floor(z);
  620.     l1lIl = x - I1OOl;
  621.     II10I = y - OOIO0;
  622.     az = z - OOl0l;
  623.     I00II = 100;
  624.     lI01I = 0;
  625.     IO0Il = 0;
  626.     l11OI = 0;
  627.     lO00O = 100;
  628.     IIOl0 = 0;
  629.     I1O10 = 0;
  630.     O0I11 = 0;
  631.     for (i = l = 0; l <= 2; i = l += 1) {
  632.       for (j = m = 0; m <= 2; j = m += 1) {
  633.         for (k = n = 0; n <= 2; k = n += 1) {
  634.           I00ll = ((I1OOl - 1 + i) % lO000) & this.lOO11;
  635.           IIlO1 = ((OOIO0 - 1 + j) % lO000) & this.lOO11;
  636.           IlI1O = ((OOl0l - 1 + k) % lO000) & this.lOO11;
  637.           px = -1 + i + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IlI1O + IIlO1]]]] * this.normalize;
  638.           OOIII = -1 + j + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[this.table[IIlO1 + IlI1O] + 1]]]] * this.normalize;
  639.           IllI0 = -1 + k + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[this.table[IIlO1 + IlI1O] + 37]]]] * this.normalize;
  640.         }
  641.         lOO00 = l1lIl - px;
  642.         OlIl1 = II10I - OOIII;
  643.         OlI0l = az - IllI0;
  644.         d = lOO00 * lOO00 + OlIl1 * OlIl1 + OlI0l * OlI0l;
  645.         if (d < I00II) {
  646.           lO00O = I00II;
  647.           IIOl0 = lI01I;
  648.           I1O10 = IO0Il;
  649.           O0I11 = l11OI;
  650.           I00II = d;
  651.           lI01I = px;
  652.           IO0Il = OOIII;
  653.           l11OI = IllI0;
  654.         } else if (d < lO00O) {
  655.           lO00O = d;
  656.           IIOl0 = px;
  657.           I1O10 = OOIII;
  658.           O0I11 = IllI0;
  659.         }
  660.       }
  661.     }
  662.     IIOlI = l1lIl - lI01I;
  663.     l1l10 = II10I - IO0Il;
  664.     ll1ll = az - l11OI;
  665.     d1 = Math.sqrt(IIOlI * IIOlI + l1l10 * l1l10 + ll1ll * ll1ll);
  666.     O1O0l = l1lIl - IIOl0;
  667.     ll0OI = II10I - I1O10;
  668.     O0l1l = az - O0I11;
  669.     d2 = Math.sqrt(O1O0l * O1O0l + ll0OI * ll0OI + O0l1l * O0l1l);
  670.     return Math.min(d1, d2) / Math.max(d1, d2);
  671.   };
  672.  
  673.   OIl0l.IO1O0 = function(size) {
  674.     var i, index, l, ref, t, v;
  675.     t = [];
  676.     for (i = l = 0, ref = size - 1; 0 <= ref ? l <= ref : l >= ref; i = 0 <= ref ? ++l : --l) {
  677.       t[i] = i;
  678.     }
  679.     v = [];
  680.     while (true) {
  681.       if (t.length === 0) {
  682.         break;
  683.       }
  684.       index = Math.floor(Math.random() * t.length);
  685.       v.push(t.splice(index, 1)[0]);
  686.     }
  687.     return v;
  688.   };
  689.  
  690.   return OIl0l;
  691.  
  692. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement