-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
570 lines (508 loc) · 30.1 KB
/
Copy pathindex.html
File metadata and controls
570 lines (508 loc) · 30.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
<!DOCTYPE html>
<html>
<head>
<title>To Be set...</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- UIkit CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.11.1/dist/css/uikit.min.css" />
</head>
<body>
<style type="text/css">
#NFT {padding-left: 0;height: 100%;overflow: visible;margin: 0;float: none;display: contents;position: unset;}
#composition {width: 100%;height: 100%;margin: 0;display: contents;align-content: center;padding: 0;}
#composition svg { min-height: 100%;max-height: 2160px;height: 100%;position: absolute;}
</style>
<div class="uk-section uk-section-default uk-preserve" id="NFT">
<div class="uk-container uk-container-large uk-preserve" id="composition"></div>
</div>
</body>
<!-- UIkit JS -->
<script src="https://cdn.jsdelivr.net/npm/uikit@3.11.1/dist/js/uikit.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/uikit@3.11.1/dist/js/uikit-icons.min.js"></script>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script type="text/javascript" >
let tminus = function() {
let count = new Date();
const timeline = {
'history': [],
'addEvent': function(item) { history.push([item,count.getTime()])},
'eventByTime': function(time) { return history.filter((d,i)=>{ d[1]===time;})},
'eventByItem': function(item) { return history.filter((d,i)=>{ JSON.stringify({'item':d[0]})===JSON.stringify({'item':item});});},
}
return {
'addone': (event)=>{ timeline.addEvent(event); },
}
}
let gMine = function() {
const fib = function(l) { return [1,1,...new Array(l)].map((v,i,a)=> { a[i+2] = a[i+1] + a[i]; return v;}); };
const golden = (fib(10)[10]/fib(10)[9]);
const random = function(digits){ let arrayL = new Uint32Array(1); let array = new Uint8Array(1); crypto.getRandomValues(arrayL);crypto.getRandomValues(array);let out = (digits < 1) ? "0.":"";digits = Math.sqrt(Math.pow(digits,2)); for (var i = 0; i < digits; ++i) {crypto.getRandomValues(arrayL); crypto.getRandomValues(array);out += arrayL[0].toString()[array[0].toString()[0]];} return parseFloat(out); };
const baseline = {"b": function(x){ return Math.floor(( (x * golden) + (x * (golden-1 ))) % 256 );},"g": function(x) { return Math.floor((x * golden) % 256 );}, "r": function(x) { return Math.floor((x * (golden - 1)) % 256);}};
const color = function(seed,l,sequence=2, hueBriS=314) { let maxSeed = ((seed)=>{ return (seed>hueBriS)?sequence*golden:seed;});let aRGB = ['r','g','b'];let ii = [[0,1,2],[1,2,0],[2,0,1],[0,2,1],[1,0,2],[2,1,0]]; let hex = function(seed) { let rgbO = [...ii[d3.randomInt(6)()]].map((v,i,a)=>{ return aRGB[v];}); return {'r': baseline[rgbO[0]](seed) , "g": baseline[rgbO[1]](seed), "b": baseline[rgbO[2]](seed) };}; let pallet = function(seed,l) { return [...new Array(l)].map((v,i,a) =>{ let s = maxSeed(seed); for(var x = 0; x<=i; ++x) { s = maxSeed(s * golden);} return hex(Math.floor(s)); });}; return { "pallet": pallet(seed,l)} };
let util = {
'nFibonacci': fib,
'pHi': golden,
'colors': (seed,l,s,h)=>{return color(seed,l,1,16581375).pallet },
'random': random,
};
return {
'functions': {
"nFibonacci": util.nFibonacci,
"pHi": golden,
"colorPallet": util.colors,
"secRandom": util.random
}
}
};
let grad = [];
const d = new gMine();
const c = d.functions;
let meBeTheOne = 0;
let RANDOM = [...new Array(100)].map((d)=>{ return c.secRandom(3);}).filter((d)=>{return d});
let RANDOM2 = [...new Array(100)].map((d)=>{ return c.secRandom(1);}).filter((d)=>{return d});
let useRandom = ()=>{ if(RANDOM.length) {} else {RANDOM = [...new Array(200)].map((d)=>{ return c.secRandom(3);}).filter((d)=>{return d}); } let r = RANDOM.pop(); return r;};
let useRandom2 = ()=>{ if(RANDOM2.length) {} else {RANDOM2 = [...new Array(200)].map((d)=>{ return c.secRandom(2);}).filter((d)=>{return d}); } let r = RANDOM2.pop(); return r;};
let height = 1080;
let margin = .02 * (c.pHi - 1 ) * height;
let width = (height * c.pHi) - margin - margin;
height = height - margin - margin;
let dims = {'w': width, 'h': height};
let palletSize = 16581375;
let fNft = d3.select("#NFT").select('#composition').append('svg');
let defs = fNft.attr('class','shapes').append('defs');
let baseTid, rebaseTid, bgS, bgE = '';
let colorCodes = [];
let defineGradiants = function(d) {
let data = d.sort((a,b)=>{return ( ((1/(a.b+2)) * a.g) + a.r) < ((1/(b.b+2)) * b.g) + b.r;}).map((v,i,a)=>{
let color = `rgb(${v.r},${v.g},${v.b})`;
colorCodes.push({'rgb': color, 'hex': '#' + ('0'+v.r.toString(16)).slice(-2) + ('0'+v.g.toString(16)).slice(-2) + ('0'+v.b.toString(16)).slice(-2)});
let stopC = bgS = `rgb(${v.r},${v.g},${v.b})`, startC = bgE = i>0?`rgb(${a[i-1].r},${a[i-1].g},${a[i-1].b})`:'#fff', tId = baseTid = `g${i}a`, rebaseTid = `g${i}b`;
grad.push(`url(#${tId})`);
grad.push(`url(#${rebaseTid})`);
return `rgb(${v.r},${v.g},${v.b})`;});
let action = defs.selectAll('.grad').data(data);
let prep = action.enter();
let lg1 = prep.append('linearGradient').attr('class','grad').attr('x1', '0%').attr('x2', '100%').attr('y1', '0%').attr('y2', '0%').attr('id', (d,i)=>{ return `g${i}a`;});
lg1.append('stop').attr('offset', '0%').attr('style', (d,i)=>{return `stop-color:${i>0?data[i-1]:'#fff'};stop-opacity:1`;});
lg1.append('stop').attr('offset', '100%').attr('style', (d,i)=>{return `stop-color:${data[i]};stop-opacity:1`;});
let lg2 = prep.append('linearGradient').attr('x1', '200%').attr('x2', '-100%').attr('y1', '100%').attr('y2', '0%').attr('id', (d,i)=>{return `g${i}b`;});
lg2.append('stop').attr('offset', '0%').attr('style', (d,i)=>{return `stop-color:${i>0?data[i-1]:'#fff'};stop-opacity:1;`;});
lg2.append('stop').attr('offset', '100%').attr('style', (d,i)=>{return `stop-color:${data[i]};stop-opacity:1`;});
action.exit().remove();
return data;
};
let swatchSize = 1000;
let colors = c.colorPallet(3,swatchSize,3,palletSize).sort((a,b)=> {return ( ((1/(a.b+2)) * a.g) + a.r) < ((1/(b.b+2)) * b.g) + b.r;});
defineGradiants(colors);
let group = fNft.selectAll('g.canvas').data([]);
let circleGroup = fNft.selectAll('g.circle').data([]);
let shapeGroup = fNft.selectAll('g.shapes').data([]);
let rectangleGroup = fNft.selectAll('g.rectangle').data([]);
let polyGroup = fNft.selectAll('g.poly').data([]);
let flower = fNft.selectAll('g.flower').data([]);
let x = d3.scaleLinear().domain([margin, width]).range([0, width + margin + margin]);
let y = Y = d3.scaleLinear().domain([margin, height]).range([0, height + margin + margin]);
//let z = d3.scaleLinear().domain([1,100]).range([...colors.map((v,i,a)=>{ return `rgb(${v.r},${v.g},${v.b})`; })]);
let z = Z = (n)=>{ let c = colors[useRandom()]; return `rgb(${c.r},${c.g},${c.b})`; };
//let points = [...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)];
let CanvasLayer = function(d,dims,m) {
let stopC = bgS = Z(useRandom()), startC = bgE = Z(useRandom()), tId = baseTid = `g${useRandom()}a`, rebaseTid = `g${useRandom()}b`;
let lg1 = defs.append('linearGradient').attr('x1', '100%').attr('x2', '0%').attr('y1', '200%').attr('y2', '-100%').attr('id', tId);
lg1.append('stop').attr('offset', '0%').attr('style', `stop-color:${startC};stop-opacity:1`);
lg1.append('stop').attr('offset', '100%').attr('style', `stop-color:${stopC};stop-opacity:1`);
let lg2 = defs.append('linearGradient').attr('x1', '200%').attr('x2', '-100%').attr('y1', '1%').attr('y2', '0%').attr('id', rebaseTid);
lg1.append('stop').attr('offset', '0%').attr('style', `stop-color:${startC};stop-opacity:1`);
lg1.append('stop').attr('offset', '100%').attr('style', `stop-color:${stopC};stop-opacity:1`);
let blur = defs.append('filter');
blur.attr('id', "f1").attr('x',0).attr('y',0).append('feGaussianBlur').attr('in',"SourceGraphic").attr('stdDeviation',c.pHi);
let specl = defs.append('filter').attr('id', 'f2');
let speclL = specl.append('feSpecularLighting').attr('result','specOut').attr('specularExponent', 8).attr('specularConstant',0.99).attr('lighting-color', bgE);
speclL.append('fePointLight').attr('x',50).attr('y',75).attr('z',200);
specl.append('feComposite').attr('in',"SourceGraphic").attr('in2',"specOut").attr('operator',"arithmetic").attr('k1',0).attr('k2',1).attr('k3',1).attr('k4',0);
let action = group.data(d);
action.enter()
.append('g')
.attr('class', 'canvas')
.append('rect')
.attr('width', '100%')//Math.floor(dims.width + m.l + m.r))
.attr('height', '100%')//Math.floor(dims.height + m.t + m.b))
.attr('stroke-width', 2 * (c.pHi))
.attr('stroke', (d)=>{ return grad[meBeTheOne+9];})
.attr('fill', (d)=>{ return grad[meBeTheOne+16];});
action.exit()
.remove();
};
let circleLayer = function(d,dims,m,stW=useRandom2,skew=false) {
let width = dims.width;
let height = dims.height;
let points = [...[...new Array(5)].map((v,i)=>{ return width * .1 * i * (Math.pow((c.pHi - 1), 1))}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return height * .1 * i * (Math.pow((c.pHi - 1), 1))}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
...[...new Array(10)].map((v,i)=>{ return width * (i*c.pHi)}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return height * .1 * i * (Math.pow((c.pHi), 1))}),
...[...new Array(5)].map((v,i)=>{ return width * .01 * i * (Math.pow((c.pHi), 1))}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
];
/* flower of life =
(𝑥−𝑎)^2+(𝑦−𝑏)^2=𝑟^2
(𝑥−(𝑎−𝑟⋅0.5))^2+(𝑦−((𝑟^2−(0.5𝑟)^2 )^0.5+𝑏))^2=𝑟^2
(𝑥−(𝑎−𝑟))^2+(𝑦−𝑏)^2=𝑟^2
*/
let pathPoints = [];
while (pathPoints.length < 1000) { pathPoints = [...[...new Array(points.length)].map((d,i)=>{ return i;}), ...pathPoints] }
let path = [...new Array(2000)].map(()=>{ let myR = useRandom();
return points[pathPoints[myR]];}).filter((v)=>{ return v;}).sort((a,b)=>{ return a<b;});
//d = [...d,...d];
let y = [useRandom(),useRandom(),useRandom()];
//let grad = [];
let data = d.map((d,i)=>{
let tId = `g${useRandom()}${useRandom()}`;
let x1Grade = y1Grade = y2Grade = 0;
let lg1 =
defs.append('linearGradient')
.attr('x1', `${x1Grade}%`)
.attr('y1', `${y1Grade}%`)
.attr('x2', '100%')
.attr('y2', `${y2Grade}%`)
.attr('id', tId);
lg1
.append('stop')
.attr('offset', '0%')
.attr('style', `stop-color:${Z(1)};stop-opacity:1`);
lg1.append('stop').attr('offset', '100%').attr('style', `stop-color:${Z(1)};stop-opacity:1`);
grad.push(`url(#${tId})`);
let y = useRandom();
let cy = path[y];
let x = useRandom();
let cx = path[x];
let z = useRandom();
let r = path[z];
cy = (cy>r*.5)?cy:cy+(r*.5);
let circle = {'cx': cx, 'cy': cy, 'r': r, 'y': y[0] * Math.pow(c.pHi,i+1), 's': 1};
return {'circle':circle} });
let skewx = useRandom();
let action = circleGroup.data(data);
let group = action.enter().append('g')
.attr('class', 'circle')
.attr('filter', (d,i)=>{ return (i%7>4)?'none':'url(#f1)';});
//.attr('transform', `skewX(${useRandom2()})`)
//.attr('transform', `skewY(${skewx})`);
group.attr('transform', (d,i)=>{ return `scale(${(i%2)?.125:.618})`});
group.append('circle')
.attr('fill', (d,i)=>{ return 'none'; })//
//.attr('stroke-width', (d,i)=>{ return d.circle.r * useRandom2() * Math.pow( (c.pHi - 1) ,i)})
//.attr('stroke-width', (d,i)=>{ return .25* d.circle.r * (c.pHi -1);})
.attr('stroke-width', (d,i)=>{ return d.circle.s; })//((c.pHi - 1) * d.circle.r)})
.attr('stroke', (d,i)=>{ return grad[((meBeTheOne+14))]; return (i>data.length*.97)?`url(#${rebaseTid})`:grad[(i)%4];})
.attr('stroke-opacity', 1)
.attr('fill', (d,i)=>{ return i%5>3?grad[((meBeTheOne+14))]:'none'; if(d.circle.r > dims.width*.25) { return 'none';} return grad[i]; (data.length * .01 < i)?grad[i]:'none';})
.attr('cy', (d,i)=>{ let val = ((data.length-(data.length%4))/4) * (dims.height/data.length) * ((i%4)+1) ; let val2 = ((i%2==0)?2:1)*d.circle.r * .5 * (2/dims.height) * dims.height; return val;})
.attr('cx', (d,i)=>{ let val = ((data.length-(data.length%2))/2) * (dims.width/data.length) * ((i%2)+1) ; let val2 = ((i%2==0)?2:1)*d.circle.r * .5 * (2/dims.width) * dims.width; return (i%3!==0)?val - (d.circle.r * .5):val + (d.circle.r * .5); }) //(i * c.pHi * d.circle.r * .0125) +
.attr('r', (d,i)=>{ let r = d.circle.r; return r})
.attr('fill-opacity', (d,i)=>{ return d.r > 1024?0:useRandom2()/useRandom2();})
.attr('transform', (d,i)=>{return (skew)?'skewY(0)':`skewX(${(i>data.length*.75)?skewx:useRandom()})`})
.attr('transform', (d,i)=>{return (skew)?'skewX(0)':`skewY(${(i>data.length*.75)?skewx:useRandom()})`})
//.attr('transform', `skewY(${useRandom2()})`)
//.attr('transform', (d,i)=>{ return `rotate3d(1, 1, 1, ${i*c.pHi}deg)`})
;
group.attr('transform', (d,i)=>{ return `translate(${useRandom2(i)},${useRandom2(i)})`});
action
.exit().remove();
};
let rectangleLayer = function(d, dims, m) {
//let grad = [];
let data = d.map((d,i)=>{
let tId = `g${useRandom()}${useRandom()}`;
let x1Grade = y1Grade = y2Grade = 0;
let lg1 =
defs.append('linearGradient')
.attr('x1', `${x1Grade}%`)
.attr('y1', `${y1Grade}%`)
.attr('x2', '100%')
.attr('y2', `${y2Grade}%`)
.attr('id', tId);
lg1
.append('stop')
.attr('offset', '0%')
.attr('style', `stop-color:${Z(1)};stop-opacity:1`);
lg1.append('stop').attr('offset', '100%').attr('style', `stop-color:${Z(1)};stop-opacity:1`);
grad.push(`url(#${tId})`);
let h = dims.height * Math.pow((c.pHi - 1), i+1);
let w = h*c.pHi;
let x = (w * (c.pHi - 1));
let y = (h * (c.pHi - 1));
return { 'h': h, 'w': w, 'x': x, 'y': y, 'sx': useRandom2(), 'sy': useRandom2(), 'sw': 16 };
});
data2 = [...data.map((d)=> {
let x2 = dims.width - d.x - d.w + m.l + m.r;
return { 'h': d.h, 'w': d.w , 'x': x2 , 'y': d.y, 'sx': d.sx, 'sy': d.sy, 'sw': d.sw };
}) ];
data2 = [...data2,...data.map((d)=> {
let y2 = dims.height - d.y - d.h + m.t + m.b;
return { 'h': d.h, 'w': d.w , 'x': d.x , 'y': y2, 'sx': d.sx, 'sy': d.sy, 'sw': d.sw };
}) ];
data2 = [...data2,...data.map((d)=> {
let y2 = dims.height - d.y - d.h + m.t + m.b;
let x2 = dims.width - d.x - d.w + m.l + m.r;
return { 'h': d.h, 'w': d.w , 'x': x2 , 'y': y2, 'sx': d.sx, 'sy': d.sy, 'sw': d.sw };
}) ];
data2 = [...data,...data2];
let action = rectangleGroup.data(data2);
action
.enter()
.append('g')
.attr('class', 'rectangle')
.attr('transform', 'scale(1)')
.attr('stroke-opacity', (d)=>{return ((d)=>{return useRandom2()/useRandom()})()})
.append('rect')
.attr('stroke-width', (d)=>{return d.sw;})
.attr('stroke', (d,i)=>{ return grad[(meBeTheOne+16)];})
.attr('fill', 'none')
.attr('x', (d)=>{return d.x;})
.attr('y', (d)=>{return d.y;})
.attr('width', (d)=>{return d.w;})
.attr('height', (d)=>{return d.h;})
.attr('transform', (d)=>{return `skewY(${d.sy})`;})
.attr('transform', (d)=>{return `skewX(${d.sx})`;});
action
.exit().remove();
};
let shapeLayer = function(d,dims,m,stW=1){
let width = dims.width;
let height = dims.height;
let points = [...[...new Array(5)].map((v,i)=>{ return width * 1 * i * (Math.pow((c.pHi - 1), 1))}),
...[...c.nFibonacci(14).slice(5,5),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return width * .1 * i * (Math.pow((c.pHi -1), 1))}),
...[...c.nFibonacci(14).slice(5,5),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return height * .1 * i * (Math.pow((c.pHi - 1), 1))}),
...[...c.nFibonacci(14).slice(5,5),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return width * .01 * i * (Math.pow((c.pHi), 1))}),
...[...c.nFibonacci(14).slice(5,5),...c.nFibonacci(14).slice(9,16)],
...[...new Array(10)].map((v,i)=>{ return width * (i*c.pHi)}),
...[...c.nFibonacci(14).slice(5,5),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return width * .001 * i * (Math.pow((c.pHi - 1), 1))}),
...[...new Array(5)].map((v,i)=>{ return height * .01 * i * (Math.pow((c.pHi), 1))}),
];
let pathPoints = [];
while (pathPoints.length < 1000) { pathPoints = [...[...new Array(points.length)].map((d,i)=>{ return i;}), ...pathPoints] }
let path = [...new Array(1000)].map((v,i)=>{
let myR = useRandom();
return points[pathPoints[myR]]>dims.height?points[pathPoints[myR]]:points[pathPoints[myR]];}).filter((v)=>{ return v;});
//let grad = [];
let randoms = d.slice(0,d.length).map((d,i)=>{ return {...[...new Array(5)],...[dims.width *.25 + useRandom(),useRandom(),useRandom2(),useRandom2(),useRandom2()]};});
let data = d.map((d,I)=>{
let i = I;
let tId = `g${useRandom()}${useRandom()}${useRandom()}`;
let x1Grade = y1Grade = y2Grade = 0;
let lg1 =
defs.append('linearGradient')
.attr('x1', `${x1Grade}%`)
.attr('y1', `${y1Grade}%`)
.attr('x2', '100%')
.attr('y2', `${y2Grade}%`)
.attr('id', tId);
lg1 .append('stop')
.attr('offset', '0%')
.attr('style', `stop-color:${Z(useRandom())};stop-opacity:1`);
lg1 .append('stop').attr('offset', '100%').attr('style', `stop-color:${Z(useRandom())};stop-opacity:1`);
grad.push(`url(#${tId})`);
//let commands = ['M','c','l','c','c','l','l','c','c','c','l','Z'];
let commands = (i%3==2)?['M','c','c','c','c','Z']:['M','l','c','c','c','c','c','c','l','c','c','c','c','Z'];
let shape = [`${commands[0]} ${useRandom() + path[i + i*2]},${useRandom() + path[i + i*2 +1]}`,
...commands.slice(1,commands.length-1)
.map( (v,i,a)=>{
return (v==='l'|| v==='L')
?`${v} ${path.slice(I + i*8).slice(0,2).map((d)=>{return Math.sqrt((Math.pow(Math.floor(d),2)))}).join(',')}`
:`${v} ${path.slice(I + i*8).slice(0,6).map((d)=>{return Math.sqrt(Math.pow(d,2));}).join(' ')}`
.split(' ').map( (v,i,a)=>{ return (i%2==1)?`${v},`:`${v} `;}).join('')})];
return shape
});
let action = shapeGroup.data(data);
let group = action
.enter()
.append('g');
group.attr('class', 'shapes');
//.attr('transform', (d,i)=>{ return `translate(${dims.height},${dims.width})`;});
group .append('path')
.attr('stroke-width', (d,i)=>{ return useRandom2() + 88;})//randoms[`${i}`][4];})
.attr('stroke', (d,i)=>{ return grad[(meBeTheOne+14)];})
.attr('stroke-opacity', .5)
.attr('fill', (d,i)=>{ return i%3>1?grad[(meBeTheOne+14)]:'none';})
.attr('d', (d)=>{ return `${d.join(' ')+'Z'}`})
group
.attr('transform', (d,i)=>{ return `skewX(${randoms[i][3]})`;});
group
.attr('transform', (d,i)=>{ return `skewY(${randoms[i][2]})`;});
group
.attr('transform', (d,i)=>{ return `translate(${randoms[i][1]} ${randoms[i][0]})`;});
group.attr('transform', 'scale(.195)');
action.exit().remove();
};
let polyLayer = function(d,dims,m,stW=1){
let width = dims.width;
let height = dims.height;
let points = [...[...new Array(5)].map((v,i)=>{ return width * .1 * i * (Math.pow((c.pHi - 1), 1))}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return height * .1 * i * (Math.pow((c.pHi - 1), 1))}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
...[...new Array(5)].map((v,i)=>{ return height * .1 * i * (Math.pow((c.pHi), 1))}),
...[...new Array(5)].map((v,i)=>{ return width * .01 * i * (Math.pow((c.pHi), 1))}),
...[...c.nFibonacci(14).slice(9,16),...c.nFibonacci(14).slice(9,16)],
];
let pathPoints = [];
while (pathPoints.length < 1000) { pathPoints = [...[...new Array(points.length)].map((d,i)=>{ return i;}), ...pathPoints] }
let ref = [];
//let grad = [];
let randoms = d.slice(0,d.length).map((d,i)=>{ return {...[...new Array(5)],...[useRandom2(),useRandom2(),useRandom2(),useRandom2(),useRandom2()]};});
d = d.map((d,i)=>{
let tId = `g${useRandom()}${useRandom()}${useRandom()}${useRandom()}`;
let x1Grade = y1Grade = y2Grade = 0;
let lg1 =
defs.append('linearGradient')
.attr('x1', `${x1Grade}%`)
.attr('y1', `${y1Grade}%`)
.attr('x2', '100%')
.attr('y2', `${y2Grade}%`)
.attr('id', tId);
lg1
.append('stop')
.attr('offset', '0%')
.attr('style', `stop-color:${z(1)};stop-opacity:1`);
lg1.append('stop').attr('offset', '100%').attr('style', `stop-color:${z(1)};stop-opacity:1`);
grad.push(`url(#${tId})`)
let path = [...new Array(6)].map(()=>{
let myR = useRandom();
return points[pathPoints[myR]]>dims.height?x(points[pathPoints[myR]]):y(points[pathPoints[myR]]);}).filter((v)=>{ return v;});
ref = path;
let poly = `${path.pop()},${path.pop()} ${ref[0]*c.pHi},${ref[1]} ${ref[0]*c.pHi * .5},${ref[0] + ref[1] * c.pHi}`;
return poly;});
let action = shapeGroup.data(d);
let group = action.enter().append('g')
.attr('class','polys')
.attr('transform', 'skewX(-120)')
.attr('opacity', 1)
.attr('transform', `rotate(-${47 * c.pHi})`);
group.append('polygon')
.attr('stroke-width',(d,i)=>{return useRandom2();})
.attr('stroke-opacity', 1)
.attr('stroke', (d,i)=>{ return grad[i+13];})
.attr('fill', (d,i)=>{ return grad[i+20]; return `url(#${baseTid})`; let num = useRandom(); let color = z(num); return color;})
.attr('fill-opacity', 1)
.attr('points', (d)=>{ return d;})
.attr('transform','scale(5)')
.attr('transform', (d,i)=>{ return `skewX(${randoms[i][2]})`;})
.attr('transform', (d,i)=>{ return `skewY(${randoms[`${i}`][3]})`;})
.attr('transform', (d,i)=>{ return `rotate(${randoms[`${i}`][4]})`;});
group.attr('transform','scale(3)');
group.attr('filter', 'url(#f1)');
action.exit().remove();
};
let drawFoL = function(data) {
let center = {'x':(dims.w / 16) , 'y': (dims.h / 16)}
let radius = (dims.h/16 * (c.pHi-1) /6);
//distance = sqrt((x2 - x1)^2 + (y2 - y1)^2) =
// (y2 - center.y) = sqrt((radius)^2 - (.5 * radius)^2)
// y2 = sqrt((radius)^2 - (.5 * radius)^2) - center.y
let steps = [];
steps.push((y1)=>{return Math.sqrt(Math.pow(Math.sqrt(Math.pow(radius,2) - Math.pow((.5 * radius),2)) - y1,2));});
steps.push((y1)=>{return Math.sqrt(Math.pow(Math.sqrt(Math.pow(radius,2) - Math.pow((.5 * radius),2)) + y1,2));});
data[0] = {'cx': center.x - radius *.5, 'cy': center.y, 'r': radius};
data[1] = {'cx': center.x + radius *.5, 'cy': center.y, 'r': radius};
data[2] = {'cx': center.x, 'cy': steps[0](center.y), 'r':radius };
data[3] = {'cx': center.x - radius * .5 , 'cy': steps[0](data[2].cy), 'r':radius };
data[4] = {'cx': center.x + radius * .5 , 'cy': steps[0](data[2].cy), 'r':radius };
data[5] = {'cx': center.x + radius * 1 , 'cy': steps[0](data[0].cy), 'r':radius };
data[6] = {'cx': center.x - radius * 1 , 'cy': steps[0](data[1].cy), 'r':radius };
data[7] = {'cx': center.x + radius * 1 , 'cy': steps[1](data[0].cy), 'r':radius };
data[8] = {'cx': center.x - radius * 1 , 'cy': steps[0](data[3].cy), 'r':radius };
data[9] = {'cx': center.x + radius * 1.5 , 'cy': steps[0](data[2].cy), 'r':radius };
data[10] = {'cx': center.x - radius * 1.5 , 'cy': steps[1](data[2].cy), 'r':radius };
data[11] = {'cx': center.x + radius * 1.5 , 'cy': steps[0](data[7].cy), 'r':radius };
data[12] = {'cx': center.x - radius * 1.5 , 'cy': steps[1](data[8].cy), 'r':radius };
data[13] = {'cx': center.x + radius * 2 , 'cy': steps[0](data[0].cy), 'r':radius };
data[14] = {'cx': center.x - radius * 2 , 'cy': steps[1](data[3].cy), 'r':radius };
data[15] = {'cx': center.x + radius * 2 , 'cy': steps[0](data[4].cy), 'r':radius };
data[16] = {'cx': center.x - radius * 2 , 'cy': steps[1](data[11].cy), 'r':radius };
data[17] = {'cx': center.x + radius * 2.5 , 'cy': steps[1](data[6].cy), 'r':radius };
data[18] = {'cx': center.x - radius * 2.5 , 'cy': steps[0](data[7].cy), 'r':radius };
data[19] = {'cx': center.x + radius * 2.5 , 'cy': steps[1](data[8].cy), 'r':radius };
data[20] = {'cx': center.x - radius * 2.5 , 'cy': steps[0](data[5].cy), 'r':radius };
data[21] = {'cx': center.x + radius * 3 , 'cy': steps[1](data[0].cy), 'r':radius };
data[22] = {'cx': center.x - radius * 3 , 'cy': steps[0](data[0].cy), 'r':radius };
data[23] = {'cx': center.x + radius * 3 , 'cy': steps[1](data[3].cy), 'r':radius };
data[24] = {'cx': center.x - radius * 3 , 'cy': steps[0](data[4].cy), 'r':radius };
data[25] = {'cx': center.x + radius * 3.5 , 'cy': steps[1](data[2].cy), 'r':radius };
data[26] = {'cx': center.x - radius * 3.5 , 'cy': steps[0](data[2].cy), 'r':radius };
data[27] = {'cx': center.x + radius * 2 , 'cy': steps[1](data[17].cy), 'r':radius };
data[28] = {'cx': center.x - radius * 2 , 'cy': steps[0](data[19].cy), 'r':radius };
data[29] = {'cx': center.x + radius * 2.5 , 'cy': steps[1](data[21].cy), 'r':radius };
data[30] = {'cx': center.x - radius * 2.5 , 'cy': steps[0](data[15].cy), 'r':radius };
data[31] = {'cx': center.x + radius * 1.5 , 'cy': steps[1](data[21].cy), 'r':radius };
data[32] = {'cx': center.x - radius * 3 , 'cy': steps[0](data[29].cy), 'r':radius };
let action = flower.data(data);
let petals = action.enter().append('g').attr('class','flower');
petals
.append('circle')
.attr('cx', (d,i)=> {return d.cx;})
.attr('cy', (d,i)=> {return d.cy;})
.attr('r', (d,i)=> {return d.r;})
.attr('fill', (d,i)=>{ return 'none'; return i===i?`${grad[20*7+18]}`:'none'})
.attr('fill-opacity', 1)
.attr('stroke-width', 1* .618 * .618 * .618 * .618 * .618 * .618 * .618* .618)
.attr('stroke-opacity', .125)
.attr('stroke', (d,i)=> {return grad[meBeTheOne+31];})
;
petals.attr('transform', 'skewY(-20)');
petals.attr('transform', 'skewX(44)');
petals.attr('transform', `scale(${1.618 * 1.618 * 1.618 * 1.618 * 1.618})`);
action.exit().remove();
};
fNft.attr('width', "100%"/*Math.floor(width + margin + margin) */).attr('height', '100%' /* Math.floor(height + margin + margin) */).attr('class', 'uk-preserve');
let draw = ((c,dims={'width':1280,'height':720},m={'t':10,'b':10,'l':10,'r':10})=>{
let fuckUjs = t = new Date();
let count = 0;
CanvasLayer([...new Array(1)], {'width': width, 'height': height},{'t':margin,'b':margin,'l':margin,'r':margin});
polyLayer([...new Array(useRandom2())],dims,m);
let test = 0;
let u = [];
// for(let i in [...new Array(20002)]){ u.push(t.getTime() *.0000001 * c.pHi * (i+1)); }
console.log(u);
// while(++count < 31) {
console.log(Math.floor(u[count]), Math.floor(u[count])%293);
//test = Math.floor(u[count])%74;
//console.log(test);
//switch(test) {
// case(16):
rectangleLayer([...new Array(3)],dims,m,32);
circleLayer([...new Array(useRandom())],dims,m,useRandom2,true);
//case(24):
//circleLayer([...new Array(8000)],dims,m,useRandom2,t.getTime()%2);
//case(32):
shapeLayer([...new Array(1)], dims,m,2);
drawFoL([...new Array(32)]);
//case(71):
// }
//}
//circleLayer([...new Array(c.nFibonacci(100)[useRandom2()] * c.nFibonacci(100)[useRandom2()]* c.nFibonacci(100)[useRandom2()])],dims,m);
});
draw(c,{'width': width, 'height': height},{'t':margin,'b':margin,'l':margin,'r':margin});
/**
setInterval(
draw, 2048, c,{'width': width, 'height': height},{'t':margin,'b':margin,'l':margin,'r':margin});
group
.append('path')
.attr('strokeWidth', 2)
.attr('stroke-width', 2)
.attr('stroke', (d)=>{ return z(c.secRandom(3));})
.attr('fill', (d)=>{ return z(c.secRandom(3));})
.attr('d',`${shape2.join(' ')+' z'}`);
**/
const ws = new WebSocket('wss://makingbands:3000');
document.addEventListener('wsServer', (d)=>{ console.log(d.detail.data); });
ws.onmessage = (msg)=>{ document.dispatchEvent(new CustomEvent('wsServer', {'bubbles': true, 'detail': msg}))};
</script>
<script src="data:text/javascript;base64,bGV0IGNvbnNvbG8gPSAnbXNnJzsKICAgICAgICAgICAgbGV0IHdvcmQgPSB7fTsKICAgICAgICAgICAgc2V0SW50ZXJ2YWwoKCk9Pnsgd29yZFtjb25zb2xvXSA9ICdFbXBpcmljYWwnOyBjb25zb2xlLmxvZyh3aW5kb3dbJ2pkJ10pOyB3aW5kb3dbJ2pkJ10gPSAnSGksIEkgaGF2ZSBhIHNlY3JldC4nO30sIDQwMDAwKTs"></script>
</html>