Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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() {
- function Gradient(O1OIO) {
- this.O1OIO = O1OIO;
- if (this.O1OIO == null) {
- this.O1OIO = [];
- }
- }
- Gradient.prototype.add = function(v) {
- return this.O1OIO.push(v);
- };
- Gradient.prototype.getInt = function(x) {
- var a, b, index, O1000, v2;
- if (this.O1OIO.length === 0) {
- return 0;
- }
- O1000 = v2 = this.O1OIO[0];
- if (x <= O1000[0]) {
- return (O1000[1] << 16) | (O1000[2] << 8) | O1000[3];
- }
- index = 1;
- while (true) {
- if (x < v2[0] || index >= this.O1OIO.length - 1) {
- break;
- }
- O1000 = v2;
- v2 = this.O1OIO[index++];
- }
- if (x >= v2[0]) {
- return (v2[1] << 16) | (v2[2] << 8) | v2[3];
- } else {
- b = (x - O1000[0]) / (v2[0] - O1000[0]);
- a = (v2[0] - x) / (v2[0] - O1000[0]);
- return ((a * O1000[1] + b * v2[1]) << 16) | ((a * O1000[2] + b * v2[2]) << 8) | ((a * O1000[3] + b * v2[3]) | 0);
- }
- };
- Gradient.prototype.get = function(x) {
- var a, b, index, O1000, v2;
- if (this.O1OIO.length === 0) {
- return [0, 0, 0];
- }
- O1000 = v2 = this.O1OIO[0];
- if (x <= O1000[0]) {
- return [O1000[1], O1000[2], O1000[3]];
- }
- index = 1;
- while (true) {
- if (x < v2[0] || index >= this.O1OIO.length - 1) {
- break;
- }
- O1000 = v2;
- v2 = this.O1OIO[index++];
- }
- if (x >= v2[0]) {
- return [v2[1], v2[2], v2[3]];
- } else {
- b = (x - O1000[0]) / (v2[0] - O1000[0]);
- a = (v2[0] - x) / (v2[0] - O1000[0]);
- return [a * O1000[1] + b * v2[1], a * O1000[2] + b * v2[2], a * O1000[3] + b * v2[3]];
- }
- };
- return Gradient;
- })();
- var lIl0O = (function() {
- function lIl0O() {}
- lIl0O.lI11l = function(h, s, v, OOI1l) {
- var b, f, g, i, p, q, r, t;
- if (OOI1l == null) {
- OOI1l = [];
- }
- i = Math.floor(h * 6);
- f = h * 6 - i;
- p = v * (1 - s);
- q = v * (1 - f * s);
- t = v * (1 - (1 - f) * s);
- switch (i % 6) {
- case 0:
- r = v;
- g = t;
- b = p;
- break;
- case 1:
- r = q;
- g = v;
- b = p;
- break;
- case 2:
- r = p;
- g = v;
- b = t;
- break;
- case 3:
- r = p;
- g = q;
- b = v;
- break;
- case 4:
- r = t;
- g = p;
- b = v;
- break;
- case 5:
- r = v;
- g = p;
- b = q;
- }
- OOI1l[0] = (r * 255) | 0;
- OOI1l[1] = (g * 255) | 0;
- OOI1l[2] = (b * 255) | 0;
- return OOI1l;
- };
- lIl0O.hsvToRgbHex = function(h, s, v) {
- var b, f, g, i, p, q, r, t;
- i = Math.floor(h * 6);
- f = h * 6 - i;
- p = v * (1 - s);
- q = v * (1 - f * s);
- t = v * (1 - (1 - f) * s);
- switch (i % 6) {
- case 0:
- r = v;
- g = t;
- b = p;
- break;
- case 1:
- r = q;
- g = v;
- b = p;
- break;
- case 2:
- r = p;
- g = v;
- b = t;
- break;
- case 3:
- r = p;
- g = q;
- b = v;
- break;
- case 4:
- r = t;
- g = p;
- b = v;
- break;
- case 5:
- r = v;
- g = p;
- b = q;
- }
- return (((r * 255) | 0) << 16) | (((g * 255) | 0) << 8) | ((b * 255) | 0);
- };
- return lIl0O;
- })();
- var O1IOI = (function() {
- function O1IOI(seed) {
- this.seed = seed != null ? seed : Math.random();
- if (this.seed < 1) {
- this.seed *= 1 << 30;
- }
- this.a = 13971;
- this.b = 12345;
- this.size = 1 << 30;
- this.lOO11 = this.size - 1;
- this.l01OI = 1 / this.size;
- this.llI0O();
- this.llI0O();
- this.llI0O();
- }
- O1IOI.prototype.next = function() {
- this.seed = (this.seed * this.a + this.b) & this.lOO11;
- return this.seed * this.l01OI;
- };
- O1IOI.prototype.Il0lO = function(O1O01, pow) {
- if (pow != null) {
- return Math.floor(Math.pow(this.next(), pow) * O1O01);
- } else {
- return Math.floor(this.next() * O1O01);
- }
- };
- O1IOI.prototype.llI0O = function() {
- return this.seed = (this.seed * this.a + this.b) & this.lOO11;
- };
- O1IOI.prototype.feed = function(number) {
- return this.seed = (this.seed * this.a * number + this.b) & this.lOO11;
- };
- return O1IOI;
- })();
- var OIl0l = (function() {
- function OIl0l(l1I01) {
- var i, l, len, ref;
- this.seed = l1I01;
- 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];
- len = this.table.length;
- for (i = l = 0, ref = len - 1; 0 <= ref ? l <= ref : l >= ref; i = 0 <= ref ? ++l : --l) {
- this.table.push(this.table[i]);
- }
- if (this.seed < 1) {
- this.seed *= 1 << 30;
- }
- this.size = 1024;
- this.normalize = 1 / 1023;
- this.lOO11 = 1023;
- this.I1I00 = this.seed & this.lOO11;
- this.OIII1 = (this.seed >> 10) & this.lOO11;
- this.I11I0 = (this.seed >> 20) & this.lOO11;
- this.c2d = [];
- this.I0lOl = Math.cos(.3);
- this.IlIOO = Math.sin(.3);
- }
- OIl0l.prototype.I0000 = function(x, y, a) {
- var c;
- c = (-2 * a + 3) * a * a;
- return x * (1 - c) + y * c;
- };
- OIl0l.prototype.I10OI = function(x, y, a) {
- return x * (1 - a) + y * a;
- };
- OIl0l.prototype.lO001 = function(x, y) {
- var l1lIl, II10I, O1000, v2, O1lll, OIlOI, I1OOl, OOIO0;
- I1OOl = Math.floor(x);
- OOIO0 = Math.floor(y);
- l1lIl = x - I1OOl;
- II10I = y - OOIO0;
- I1OOl = I1OOl & this.lOO11;
- OOIO0 = OOIO0 & this.lOO11;
- O1000 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.OIII1]]];
- v2 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.OIII1]]];
- O1lll = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.OIII1]]];
- OIlOI = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.OIII1]]];
- return this.I0000(this.I0000(O1000, v2, l1lIl), this.I0000(O1lll, OIlOI, l1lIl), II10I) * this.normalize;
- };
- OIl0l.prototype.l0lOl = function(x, y, z) {
- var l1lIl, II10I, az, O1000, v2, O1lll, OIlOI, lIIIO, O1lI1, l0IO1, OIl0I, l1110, Ol1lI, I1OOl, OOIO0, OOl0l;
- I1OOl = Math.floor(x);
- OOIO0 = Math.floor(y);
- OOl0l = Math.floor(z);
- l1lIl = x - I1OOl;
- II10I = y - OOIO0;
- az = z - OOl0l;
- I1OOl = I1OOl & this.lOO11;
- OOIO0 = OOIO0 & this.lOO11;
- OOl0l = OOl0l & this.lOO11;
- O1000 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- v2 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- O1lll = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- OIlOI = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- lIIIO = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- O1lI1 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- l0IO1 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- OIl0I = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- l1110 = this.I0000(this.I0000(O1000, v2, l1lIl), this.I0000(O1lll, OIlOI, l1lIl), II10I);
- Ol1lI = this.I0000(this.I0000(lIIIO, O1lI1, l1lIl), this.I0000(l0IO1, OIl0I, l1lIl), II10I);
- return this.I0000(l1110, Ol1lI, az) * this.normalize;
- };
- OIl0l.prototype.I1OII = function(x, y, z) {
- var l1lIl, II10I, az, O1000, v2, O1lll, OIlOI, lIIIO, O1lI1, l0IO1, OIl0I, l1110, Ol1lI, I1OOl, OOIO0, OOl0l;
- I1OOl = Math.floor(x);
- OOIO0 = Math.floor(y);
- OOl0l = Math.floor(z);
- l1lIl = x - I1OOl;
- II10I = y - OOIO0;
- az = z - OOl0l;
- I1OOl = I1OOl & this.lOO11;
- OOIO0 = OOIO0 & this.lOO11;
- OOl0l = OOl0l & this.lOO11;
- O1000 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- v2 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- O1lll = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- OIlOI = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + this.I11I0]]]]];
- lIIIO = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- O1lI1 = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- l0IO1 = this.table[this.I1I00 + this.table[I1OOl + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- OIl0I = this.table[this.I1I00 + this.table[I1OOl + 1 + this.table[OOIO0 + 1 + this.table[this.OIII1 + this.table[OOl0l + 1 + this.I11I0]]]]];
- l1110 = this.I10OI(this.I10OI(O1000, v2, l1lIl), this.I10OI(O1lll, OIlOI, l1lIl), II10I);
- Ol1lI = this.I10OI(this.I10OI(lIIIO, O1lI1, l1lIl), this.I10OI(l0IO1, OIl0I, l1lIl), II10I);
- return this.I10OI(l1110, Ol1lI, az) * this.normalize;
- };
- OIl0l.prototype.OIOO0 = function(lO1O1, I11l0, iz) {};
- OIl0l.prototype.l0l1l = function(x, y, OlI10, O001l, lllO0, lOOOO, ts) {
- var d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- I0l1O = 0;
- d = 1;
- l01OI = 0;
- for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
- I0l1O += this.lO001(x, y) * d;
- l01OI += d;
- d *= O001l;
- O0IOl = lllO0 * (x * lOOOO + y * ts);
- OlII0 = lllO0 * (y * lOOOO - x * ts);
- x = O0IOl;
- y = OlII0;
- }
- return I0l1O / l01OI;
- };
- OIl0l.prototype.Il0I1 = function(x, y, z, OlI10, O001l, lllO0, lOOOO, ts) {
- var d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- I0l1O = 0;
- d = 1;
- l01OI = 0;
- for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
- I0l1O += this.l0lOl(x, y, z) * d;
- l01OI += d;
- d *= O001l;
- O0IOl = lllO0 * (x * lOOOO + y * ts);
- OlII0 = lllO0 * (y * lOOOO - x * ts);
- x = O0IOl;
- y = OlII0;
- z = lllO0 * z;
- }
- return I0l1O / l01OI;
- };
- OIl0l.prototype.O1l11 = function(x, y, lO000, OlI10, O001l, lllO0, lOOOO, ts) {
- var l1lIl, II10I, lO1O1, I11l0, O1000, v2, O1lll, OIlOI;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- lO1O1 = Math.floor(x / lO000);
- I11l0 = Math.floor(y / lO000);
- l1lIl = x / lO000 - lO1O1;
- II10I = y / lO000 - I11l0;
- O1000 = this.l0l1l(l1lIl * lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
- v2 = this.l0l1l(l1lIl * lO000 + lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
- O1lll = this.l0l1l(l1lIl * lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
- OIlOI = this.l0l1l(l1lIl * lO000 + lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
- return this.I0000(this.I0000(O1000, v2, 1 - l1lIl), this.I0000(O1lll, OIlOI, 1 - l1lIl), 1 - II10I);
- };
- OIl0l.prototype.turbulence2d = function(x, y, OlI10, O001l, lllO0, lOOOO, ts) {
- var d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- I0l1O = 0;
- d = 1;
- l01OI = 0;
- for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
- I0l1O += 2 * (.5 - Math.abs(.5 - this.lO001(x, y))) * d;
- l01OI += d;
- d *= O001l;
- O0IOl = lllO0 * (x * lOOOO + y * ts);
- OlII0 = lllO0 * (y * lOOOO - x * ts);
- x = O0IOl;
- y = OlII0;
- }
- return I0l1O / l01OI;
- };
- OIl0l.prototype.periodicTurbulence2d = function(x, y, lO000, OlI10, O001l, lllO0, lOOOO, ts) {
- var l1lIl, II10I, lO1O1, I11l0, O1000, v2, O1lll, OIlOI;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- lO1O1 = Math.floor(x / lO000);
- I11l0 = Math.floor(y / lO000);
- l1lIl = x / lO000 - lO1O1;
- II10I = y / lO000 - I11l0;
- O1000 = this.turbulence2d(l1lIl * lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
- v2 = this.turbulence2d(l1lIl * lO000 + lO000, II10I * lO000, OlI10, O001l, lllO0, lOOOO, ts);
- O1lll = this.turbulence2d(l1lIl * lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
- OIlOI = this.turbulence2d(l1lIl * lO000 + lO000, II10I * lO000 + lO000, OlI10, O001l, lllO0, lOOOO, ts);
- return this.I0000(this.I0000(O1000, v2, 1 - l1lIl), this.I0000(O1lll, OIlOI, 1 - l1lIl), 1 - II10I);
- };
- OIl0l.prototype.OOIIl = function(x, y, OlI10, O001l, lllO0, lOOOO, ts) {
- var Ol11I, d, i, l, l01OI, O0IOl, OlII0, ref, I0l1O, v;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- I0l1O = 0;
- Ol11I = 1;
- d = 1;
- l01OI = 0;
- for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
- v = this.lO001(x, y) * 2;
- if (v > 1) {
- v = 2 - v;
- }
- v = Math.pow(v, 2);
- I0l1O += Ol11I * d * v;
- Ol11I = v;
- l01OI += d;
- d *= O001l;
- O0IOl = lllO0 * (x * lOOOO + y * ts);
- OlII0 = lllO0 * (y * lOOOO - x * ts);
- x = O0IOl;
- y = OlII0;
- }
- return I0l1O / l01OI;
- };
- OIl0l.prototype.IOIlI = function(x, y, z, OlI10, O001l, lllO0, lOOOO, ts) {
- var Ol11I, d, i, l, lIO0l, l01OI, O0IOl, OlII0, I0I0l, ref, I0l1O, v;
- if (OlI10 == null) {
- OlI10 = 5;
- }
- if (O001l == null) {
- O001l = .5;
- }
- if (lllO0 == null) {
- lllO0 = 1.9;
- }
- if (lOOOO == null) {
- lOOOO = this.I0lOl;
- }
- if (ts == null) {
- ts = this.IlIOO;
- }
- I0l1O = 0;
- Ol11I = 1;
- d = 1;
- l01OI = 0;
- for (i = l = 1, ref = OlI10; l <= ref; i = l += 1) {
- v = this.l0lOl(x, y, z) * 2;
- if (v > 1) {
- v = 2 - v;
- }
- v = Math.pow(v, 2);
- I0l1O += Ol11I * d * v;
- Ol11I = v;
- l01OI += d;
- d *= O001l;
- O0IOl = x * lOOOO + y * ts;
- OlII0 = y * lOOOO - x * ts;
- lIO0l = OlII0 * lOOOO + z * ts;
- I0I0l = z * lOOOO - OlII0 * ts;
- x = lllO0 * O0IOl;
- y = lllO0 * lIO0l;
- z = lllO0 * I0I0l;
- }
- return I0l1O / l01OI;
- };
- OIl0l.prototype.IlI0I = function(x, y, lO000) {
- 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;
- I1OOl = Math.floor(x);
- OOIO0 = Math.floor(y);
- l1lIl = x - I1OOl;
- II10I = y - OOIO0;
- I00II = 100;
- lI01I = 0;
- IO0Il = 0;
- lO00O = 100;
- IIOl0 = 0;
- I1O10 = 0;
- for (i = l = 0; l <= 2; i = l += 1) {
- for (j = m = 0; m <= 2; j = m += 1) {
- I00ll = (I1OOl - 1 + i) % lO000;
- IIlO1 = (OOIO0 - 1 + j) % lO000;
- px = -1 + i + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + IIlO1]]] * this.normalize * .8 + .1;
- OOIII = -1 + j + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IIlO1 + 1]]]] * this.normalize * .8 + .1;
- lOO00 = l1lIl - px;
- OlIl1 = II10I - OOIII;
- d = lOO00 * lOO00 + OlIl1 * OlIl1;
- if (d < I00II) {
- lO00O = I00II;
- IIOl0 = lI01I;
- I1O10 = IO0Il;
- I00II = d;
- lI01I = px;
- IO0Il = OOIII;
- } else if (d < lO00O) {
- lO00O = d;
- IIOl0 = px;
- I1O10 = OOIII;
- }
- }
- }
- IIOlI = l1lIl - lI01I;
- l1l10 = II10I - IO0Il;
- d1 = Math.sqrt(IIOlI * IIOlI + l1l10 * l1l10);
- O1O0l = l1lIl - IIOl0;
- ll0OI = II10I - I1O10;
- d2 = Math.sqrt(O1O0l * O1O0l + ll0OI * ll0OI);
- return Math.min(d1, d2) / Math.max(d1, d2);
- };
- OIl0l.prototype.ll0I0 = function(x, y, lO000) {
- var l1lIl, II10I, I00II, lI01I, IO0Il, OI01I, d, lOO00, OlIl1, i, j, l, m, px, OOIII, seed, I1OOl, I00ll, OOIO0, IIlO1;
- I1OOl = Math.floor(x);
- OOIO0 = Math.floor(y);
- l1lIl = x - I1OOl;
- II10I = y - OOIO0;
- I00II = 100;
- lI01I = 0;
- IO0Il = 0;
- OI01I = 0;
- for (i = l = 0; l <= 2; i = l += 1) {
- for (j = m = 0; m <= 2; j = m += 1) {
- I00ll = (I1OOl - 1 + i) % lO000;
- IIlO1 = (OOIO0 - 1 + j) % lO000;
- px = -1 + i + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + IIlO1]]] * this.normalize * .8 + .1;
- OOIII = -1 + j + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IIlO1 + 1]]]] * this.normalize * .8 + .1;
- seed = this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IIlO1 + 17]]]];
- lOO00 = l1lIl - px;
- OlIl1 = II10I - OOIII;
- d = lOO00 * lOO00 + OlIl1 * OlIl1;
- if (d < I00II) {
- I00II = d;
- lI01I = px;
- IO0Il = OOIII;
- OI01I = seed;
- }
- }
- }
- return OI01I * this.normalize;
- };
- OIl0l.prototype.Oll10 = function(x, y, z, lO000) {
- 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;
- if (lO000 == null) {
- lO000 = 100;
- }
- I1OOl = Math.floor(x);
- OOIO0 = Math.floor(y);
- OOl0l = Math.floor(z);
- l1lIl = x - I1OOl;
- II10I = y - OOIO0;
- az = z - OOl0l;
- I00II = 100;
- lI01I = 0;
- IO0Il = 0;
- l11OI = 0;
- lO00O = 100;
- IIOl0 = 0;
- I1O10 = 0;
- O0I11 = 0;
- for (i = l = 0; l <= 2; i = l += 1) {
- for (j = m = 0; m <= 2; j = m += 1) {
- for (k = n = 0; n <= 2; k = n += 1) {
- I00ll = ((I1OOl - 1 + i) % lO000) & this.lOO11;
- IIlO1 = ((OOIO0 - 1 + j) % lO000) & this.lOO11;
- IlI1O = ((OOl0l - 1 + k) % lO000) & this.lOO11;
- px = -1 + i + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[IlI1O + IIlO1]]]] * this.normalize;
- OOIII = -1 + j + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[this.table[IIlO1 + IlI1O] + 1]]]] * this.normalize;
- IllI0 = -1 + k + this.table[this.I1I00 + this.table[I00ll + this.table[this.OIII1 + this.table[this.table[IIlO1 + IlI1O] + 37]]]] * this.normalize;
- }
- lOO00 = l1lIl - px;
- OlIl1 = II10I - OOIII;
- OlI0l = az - IllI0;
- d = lOO00 * lOO00 + OlIl1 * OlIl1 + OlI0l * OlI0l;
- if (d < I00II) {
- lO00O = I00II;
- IIOl0 = lI01I;
- I1O10 = IO0Il;
- O0I11 = l11OI;
- I00II = d;
- lI01I = px;
- IO0Il = OOIII;
- l11OI = IllI0;
- } else if (d < lO00O) {
- lO00O = d;
- IIOl0 = px;
- I1O10 = OOIII;
- O0I11 = IllI0;
- }
- }
- }
- IIOlI = l1lIl - lI01I;
- l1l10 = II10I - IO0Il;
- ll1ll = az - l11OI;
- d1 = Math.sqrt(IIOlI * IIOlI + l1l10 * l1l10 + ll1ll * ll1ll);
- O1O0l = l1lIl - IIOl0;
- ll0OI = II10I - I1O10;
- O0l1l = az - O0I11;
- d2 = Math.sqrt(O1O0l * O1O0l + ll0OI * ll0OI + O0l1l * O0l1l);
- return Math.min(d1, d2) / Math.max(d1, d2);
- };
- OIl0l.IO1O0 = function(size) {
- var i, index, l, ref, t, v;
- t = [];
- for (i = l = 0, ref = size - 1; 0 <= ref ? l <= ref : l >= ref; i = 0 <= ref ? ++l : --l) {
- t[i] = i;
- }
- v = [];
- while (true) {
- if (t.length === 0) {
- break;
- }
- index = Math.floor(Math.random() * t.length);
- v.push(t.splice(index, 1)[0]);
- }
- return v;
- };
- return OIl0l;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement