-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathscript.js
More file actions
13592 lines (13592 loc) · 360 KB
/
Copy pathscript.js
File metadata and controls
13592 lines (13592 loc) · 360 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
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function _j1(_j1532, _j1533) {
var _j204 = window.SHADER_SOURCES && window.SHADER_SOURCES[_j1532];
var _j205 = window.SHADER_SOURCES && window.SHADER_SOURCES[_j1533];
if (_j204 && _j205 && typeof createShader === 'function') {
return createShader(_j204, _j205);
}
return window['loadShader'](_j1532, _j1533);
}
class Crandom {
constructor() {
this.globalCount = 0;
this.callHistory = [];
this.enableHistory = false;
this.currentSeed = null;
}
reset() {
this.globalCount = 0;
this.callHistory = [];
}
getCount() {
return this.globalCount;
}
setSeed(seed) {
this.currentSeed = seed;
}
getHistory() {
return this.callHistory;
}
setHistoryEnabled(enabled) {
this.enableHistory = enabled;
}
random(...args) {
this.globalCount++;
if (this.enableHistory) {
const stack = new Error().stack;
const _j206 = stack.split('\n')[2];
this.callHistory.push({
count: this.globalCount,
args: args,
caller: _j206,
seed: this.currentSeed,
timestamp: Date.now()
});
}
if (args.length === 0) {
return random();
} else if (args.length === 1) {
if (Array.isArray(args[0])) {
return random(args[0]);
} else {
return random(args[0]);
}
} else if (args.length === 2) {
return random(args[0], args[1]);
}
}
printStats() {
console.log('═══════════════════════════════════════');
console.log('📊 Crandom 統計信息');
console.log('═══════════════════════════════════════');
console.log(`總調用次數: ${this.globalCount}`);
console.log(`當前種子: ${this.currentSeed || 'N/A'}`);
console.log(`歷史記錄: ${this.enableHistory ? '啟用' : '禁用'}`);
if (this.enableHistory) {
console.log(`記錄條數: ${this.callHistory.length}`);
}
console.log('═══════════════════════════════════════');
}
printRecentHistory(n = 10) {
if (!this.enableHistory) {
console.warn('⚠️ 歷史記錄未啟用');
return;
}
const _j207 = this.callHistory.slice(-n);
console.log('═══════════════════════════════════════');
console.log(`📝 最近 ${_j207.length} 條 random() 調用`);
console.log('═══════════════════════════════════════');
_j207.forEach((_j637, _j315) => {
console.log(`[${_j637.count}] args: [${_j637.args.join(', ')}]`);
if (_j637.caller) {
console.log(` 位置: ${_j637.caller.trim()}`);
}
});
console.log('═══════════════════════════════════════');
}
static compare(count1, count2, label1 = 'Point 1', label2 = 'Point 2') {
const _j208 = count2 - count1;
console.log('═══════════════════════════════════════');
console.log('🔍 Crandom 計數比較');
console.log('═══════════════════════════════════════');
console.log(`${label1}: ${count1}`);
console.log(`${label2}: ${count2}`);
console.log(`差異: ${_j208 > 0 ? '+' : ''}${_j208}`);
console.log('═══════════════════════════════════════');
return _j208;
}
}
class _j0 {
constructor() {
this.checkpoints = [];
this.currentStrokeCheckpoints = [];
this.recordingCheckpoints = [];
this.playbackCheckpoints = [];
this.enabled = true;
}
checkpoint(name, category = 'general') {
if (!this.enabled) return;
const count = crandom.getCount();
const checkpoint = {
name: name,
category: category,
count: count,
timestamp: Date.now()
};
this.currentStrokeCheckpoints.push(checkpoint);
}
resetStroke() {
this.currentStrokeCheckpoints = [];
}
saveStroke(mode, strokeNumber) {
const strokeData = {
mode: mode,
strokeNumber: strokeNumber,
checkpoints: [...this.currentStrokeCheckpoints],
totalCount: crandom.getCount()
};
if (mode === 'recording') {
this.recordingCheckpoints.push(strokeData);
} else if (mode === 'playback') {
this.playbackCheckpoints.push(strokeData);
}
}
compareStroke(strokeNumber) {
const recording = this.recordingCheckpoints.find(s => s.strokeNumber === strokeNumber);
const playback = this.playbackCheckpoints.find(s => s.strokeNumber === strokeNumber);
if (!recording) return;
if (!playback) {
console.error(`❌ 找不到播放筆劃 ${strokeNumber}`);
return;
}
const _j209 = playback.totalCount - recording.totalCount;
const percent = ((_j209 / recording.totalCount) * 100).toFixed(2) + '%';
const icon = Math.abs(_j209) < 50 ? '✅' : Math.abs(_j209) < 200 ? '⚠️' : '❌';
console.log(`${icon} 筆劃 ${strokeNumber} | 差異: ${_j209 > 0 ? '+' : ''}${_j209} (${percent})`);
const recDeltas = this.calculateDeltas(recording.checkpoints);
const playDeltas = this.calculateDeltas(playback.checkpoints);
const _j210 = new Set([...recDeltas.keys(), ...playDeltas.keys()]);
const _j211 = Array.from(_j210).sort((a, b) => {
const indexA = Array.from(recDeltas.keys()).indexOf(a);
const _j212 = Array.from(recDeltas.keys()).indexOf(b);
if (indexA === -1 && _j212 === -1) return 0;
if (indexA === -1) return 1;
if (_j212 === -1) return -1;
return indexA - _j212;
});
let _j213 = 0;
const _j214 = [];
for (const stage of _j211) {
const recCount = recDeltas.get(stage) || 0;
const _j215 = playDeltas.get(stage) || 0;
const _j208 = _j215 - recCount;
_j213 += _j208;
if (Math.abs(_j208) > 0) {
_j214.push({
stage: stage,
recordingCount: recCount,
playbackCount: _j215,
difference: _j208
});
}
}
if (Math.abs(playback.totalCount - recording.totalCount) > 200) {
_j214.sort((a, b) => Math.abs(b.difference) - Math.abs(a.difference));
const _j216 = _j214.filter(d => Math.abs(d.difference) > 50);
if (_j216.length > 0) {
console.log(' ⚠️ 主要差異階段:');
for (let i = 0; i < Math.min(2, _j216.length); i++) {
const d = _j216[i];
const icon = d.difference > 0 ? '🔺' : '🔻';
console.log(` ${icon} ${d.stage}: ${d.difference}`);
}
}
}
}
calculateDeltas(checkpoints) {
const _j217 = new Map();
for (let i = 0; i < checkpoints.length; i++) {
const _j218 = checkpoints[i];
const _j219 = checkpoints[i + 1];
if (_j219) {
const _j220 = `${_j218.name} → ${_j219.name}`;
const _j221 = _j219.count - _j218.count;
_j217.set(_j220, _j221);
}
}
return _j217;
}
clear() {
this.recordingCheckpoints = [];
this.playbackCheckpoints = [];
this.currentStrokeCheckpoints = [];
}
setEnabled(enabled) {
this.enabled = enabled;
}
}
window.crandom = new Crandom();
window.Crandom = Crandom;
window.crandomDebugger = new _j0();
const _j222 = [{
id: 0,
name: 'black',
displayName: '黑色',
rgb: [26, 26, 26],
hex: '#1A1A1A'
}, {
id: 1,
name: 'white',
displayName: '白色',
rgb: [242, 242, 242],
hex: '#F2F2F2'
}, {
id: 29,
name: 'medium_gray',
displayName: '中灰色',
rgb: [155, 155, 155],
hex: '#9B9B9B'
}, {
id: 2,
name: 'dark_gray',
displayName: '深灰色',
rgb: [47, 47, 47],
hex: '#2F2F2F'
}, {
id: 3,
name: 'medium_gray_new',
displayName: '中灰色',
rgb: [85, 85, 85],
hex: '#555555'
}, {
id: 4,
name: 'light_gray_new',
displayName: '浅灰色',
rgb: [150, 150, 150],
hex: '#969696'
}, {
id: 12,
name: 'light_gray',
displayName: '浅灰色',
rgb: [136, 122, 125],
hex: '#847A7D'
}, {
id: 22,
name: 'silver',
displayName: '银灰色',
rgb: [181, 180, 185],
hex: '#B5B4B9'
}, {
id: 13,
name: 'blue_gray',
displayName: '蓝灰色',
rgb: [138, 57, 26],
hex: '#8A391A'
}, {
id: 19,
name: 'gray_brown',
displayName: '灰褐色',
rgb: [128, 125, 114],
hex: '#807D72'
}, {
id: 26,
name: 'khaki',
displayName: '卡其色',
rgb: [165, 162, 147],
hex: '#A5A293'
}, {
id: 20,
name: 'sage_gray',
displayName: '鼠尾草灰',
rgb: [121, 132, 129],
hex: '#798481'
}, {
id: 24,
name: 'gray_green',
displayName: '青灰色',
rgb: [148, 162, 158],
hex: '#94A29E'
}, {
id: 28,
name: 'mauve_gray',
displayName: '淡紫灰',
rgb: [174, 161, 164],
hex: '#AEA1A4'
}, {
id: 23,
name: 'beige',
displayName: '米色',
rgb: [235, 220, 201],
hex: '#EBDCC9'
}, {
id: 25,
name: 'tan',
displayName: '驼色',
rgb: [210, 169, 151],
hex: '#D2A997'
}, {
id: 14,
name: 'terra_cotta',
displayName: '赭石色',
rgb: [112, 79, 57],
hex: '#704F39'
}, {
id: 21,
name: 'brick_red',
displayName: '砖红色',
rgb: [159, 114, 85],
hex: '#9F7255'
}, {
id: 7,
name: 'brown',
displayName: '咖啡色',
rgb: [175, 140, 89],
hex: '#AF8C59'
}, {
id: 8,
name: 'green_dark',
displayName: '墨綠色',
rgb: [4, 130, 130],
hex: '#048282'
}, {
id: 5,
name: 'green',
displayName: '绿色',
rgb: [63, 77, 24],
hex: '#3F4D18'
}, {
id: 15,
name: 'olive_green',
displayName: '橄榄绿',
rgb: [168, 200, 72],
hex: '#A8C848'
}, {
id: 11,
name: 'lime',
displayName: '浅绿色',
rgb: [138, 149, 73],
hex: '#8A9549'
}, {
id: 9,
name: 'blue_dark',
displayName: '深蓝色',
rgb: [57, 80, 192],
hex: '#3950C0'
}, {
id: 32,
name: 'blue',
displayName: '蓝色',
rgb: [2, 66, 109],
hex: '#02426D'
}, {
id: 10,
name: 'purple',
displayName: '紫色',
rgb: [140, 106, 172],
hex: '#8C6AAC'
}, {
id: 17,
name: 'wine_red',
displayName: '酒红色',
rgb: [128, 49, 52],
hex: '#803134'
}, {
id: 27,
name: 'dusty_rose',
displayName: '雾玫瑰色',
rgb: [203, 243, 251],
hex: '#CBF3FB'
}, {
id: 16,
name: 'pink',
displayName: '粉红色',
rgb: [240, 170, 207],
hex: '#F0AACF'
}, {
id: 30,
name: 'red',
displayName: '红色',
rgb: [208, 34, 63],
hex: '#D02340'
}, {
id: 18,
name: 'gold_orange',
displayName: '金橙色',
rgb: [233, 175, 52],
hex: '#E9AF34'
}, {
id: 6,
name: 'orange',
displayName: '橙色',
rgb: [255, 160, 62],
hex: '#FEA03E'
}, {
id: 31,
name: 'yellow',
displayName: '黄色',
rgb: [255, 249, 56],
hex: '#FFF938'
}, {
id: 34,
name: 'coral',
displayName: '珊瑚色',
rgb: [255, 127, 80],
hex: '#FF7F50'
}, {
id: 35,
name: 'mint',
displayName: '薄荷绿',
rgb: [152, 251, 152],
hex: '#98FB98'
}];
function _j2() {
const _j223 = {};
_j222.forEach(color => {
_j223[color.id] = {
name: color.name,
rgb: color.rgb,
channel: _j3(color.rgb)
};
});
return _j223;
}
function _j3(rgb) {
const [r, g, b] = rgb;
const _j224 = r > 20;
const _j225 = g > 20;
const _j226 = b > 20;
if (_j224 && _j225 && _j226) return 'rgb';
if (_j224 && _j225) return 'rg';
if (_j224 && _j226) return 'rb';
if (_j225 && _j226) return 'gb';
if (_j224) return 'r';
if (_j225) return 'g';
if (_j226) return 'b';
return 'rgb';
}
function _j4() {
let _j227 = '// ============================================\n';
_j227 += '// 🎨 颜色常量(由 colors.js 自动生成)\n';
_j227 += '// ============================================\n';
_j222.forEach(color => {
const [r, g, b] = color.rgb;
const _j228 = `COLOR_${color.name.toUpperCase()}`;
_j227 += `const vec3 ${_j228} = vec3(${r}.0/255.0, ${g}.0/255.0, ${b}.0/255.0);`;
_j227 += ` // ${color.displayName} ${color.hex}\n`;
});
return _j227;
}
function _j5() {
let _j227 = '';
_j222.forEach((color, _j315) => {
const _j228 = `COLOR_${color.name.toUpperCase()}`;
if (_j315 === 0) {
_j227 += ` if (brushMode == ${color.id}) {\n`;
} else {
_j227 += ` } else if (brushMode == ${color.id}) {\n`;
}
_j227 += ` brushColor = ${_j228};\n`;
});
_j227 += ` }\n`;
return _j227;
}
function _j6() {
return _j222.map(color => ({
id: color.id,
name: color.name,
displayName: color.displayName,
hex: color.hex
}));
}
function _j7(id) {
return _j222.find(c => c.id === id);
}
function _j8(name) {
return _j222.find(c => c.name === name);
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = {
_j222,
_j2,
_j4,
_j5,
_j6,
_j7,
_j8
};
}
let _j229 = null;
let _j230 = 0;
const _j231 = 2000;
function _j9(_j533 = 120, _j1534 = 12, _j1535 = 10, _j1536 = 5) {
const _j232 = Math.min(width, _j231);
const _j233 = Math.min(height, _j231);
const _j234 = (width > _j231 || height > _j231);
randomSeed(seed);
const _j235 = _j10(_j533, _j1536);
const _j236 = createGraphics(_j232, _j233, P2D);
const _j237 = createGraphics(_j232, _j233, P2D);
for (let i = -_j533; i < _j232 + _j533; i += _j232 / 500) {
for (let j = -_j533; j < _j233 + _j533; j += _j1534) {
_j236.image(_j235, i, j + (noise(i * 0.1, j * 1.0) - 0.5) * _j1535);
}
}
_j235.remove();
if (doSpotNoise) {
padfactor = 300;
_j237.blendMode(DIFFERENCE);
for (let i = 0; i < 400; i++) {
x = random(_j232)
y = random(_j233)
_j237.push()
_j237.strokeWeight(random(1, 2))
_j237.stroke(0, random(10, 250))
_j237.noFill();
_j237.bezier(
random(-padfactor, _j232 + padfactor),
random(-padfactor, _j233 + padfactor),
random(-padfactor, _j232 + padfactor),
random(-padfactor, _j233 + padfactor),
random(-padfactor, _j232 + padfactor),
random(-padfactor, _j233 + padfactor),
random(-padfactor, _j232 + padfactor),
random(-padfactor, _j233 + padfactor)
);
_j237.pop();
}
_j236.blendMode(DIFFERENCE);
_j236.image(_j237, 0, 0, _j232, _j233);
_j237.remove();
}
if (_j234) {
const _j238 = createGraphics(width, height);
_j238.image(_j236, 0, 0, width, height);
_j236.remove();
return _j238;
}
return _j236;
}
function _j10(_j1537 = 64, _j1536 = 0.5) {
const _j235 = createGraphics(_j1537, _j1537);
_j235.pixelDensity(1);
_j235.noSmooth();
_j235.clear();
_j235.noFill();
_j235.translate(_j1537 / 2, _j1537 / 2);
_j235.strokeWeight(1.5);
for (let i = 0; i < 100; i++) {
const _j239 = 0.5 + crandom.random(0, 1) * 0.5;
const _j240 = pow(_j239, _j1536) * 255;
_j235.stroke(_j240, _j240, _j240, 255);
const radius = crandom.random() * _j1537 * 0.5;
const angle = crandom.random() * TWO_PI;
const x = radius * Math.cos(angle);
const y = radius * Math.sin(angle);
_j235.point(x, y);
}
_j235.resetMatrix();
return _j235;
}
let _j241 = [];
function _j11(x, y, size, seed, shapeType = null) {
randomSeed(seed);
noiseSeed(seed);
if (shapeType === null || shapeType === undefined) {
shapeType = floor(crandom.random(0, 2));
shapeType = floor(crandom.random(2, 4));
} else {
shapeType = floor(constrain(shapeType, 0, 3));
}
switch (shapeType) {
case 0:
return _j13(size * 1.3, seed);
case 1:
return _j14(size, seed);
case 2:
return _j15(size, seed);
case 3:
return _j16(size, seed);
default:
return _j12(size, seed);
}
}
function _j12(size, seed) {
randomSeed(seed);
noiseSeed(seed);
const circles = [];
const _j242 = 8;
const _j243 = [];
for (let i = 0; i < _j242; i++) {
_j243.push({
numCirclesRand: i === 0 ? crandom.random(3, 8) : null,
angle: crandom.random(TWO_PI),
distance: crandom.random(0, size * 0.4),
circleSize: crandom.random(size * 0.4, size * 0.8)
});
}
const _j244 = floor(_j243[0].numCirclesRand);
for (let i = 0; i < _j244; i++) {
const _j245 = _j243[i];
circles.push({
x: cos(_j245.angle) * _j245.distance,
y: sin(_j245.angle) * _j245.distance,
radius: _j245.circleSize
});
}
return {
type: 'cluster',
circles
};
}
function _j13(size, seed) {
randomSeed(seed);
noiseSeed(seed);
const _j246 = [];
const _j247 = 3;
const _j248 = 48;
const _j243 = [];
const _j249 = crandom.random(1, 4);
const _j250 = crandom.random(0.4, 0.6);
const _j251 = floor(_j249);
for (let _j252 = 0; _j252 < _j247; _j252++) {
const _j253 = {
offsetX: crandom.random(-size * 0.2, size * 0.2),
offsetY: crandom.random(-size * 0.2, size * 0.2),
layerRotation: crandom.random(-PI / 4, PI / 4),
sizeVariation: crandom.random(0.85, 1.15),
numVerticesRand: crandom.random(36, 48),
noiseOffset: crandom.random(1000) + _j252 * 500
};
_j243.push(_j253);
}
for (let _j252 = 0; _j252 < _j251; _j252++) {
const _j253 = _j243[_j252];
const offsetX = _j253.offsetX;
const offsetY = _j253.offsetY;
const layerRotation = _j253.layerRotation;
const sizeVariation = _j253.sizeVariation;
const _j254 = size * sizeVariation;
const _j255 = floor(_j253.numVerticesRand);
const noiseOffset = _j253.noiseOffset;
const _j256 = [];
for (let i = 0; i < _j255; i++) {
const angle = (i / _j255) * TWO_PI;
const _j257 = noise(cos(angle) * 1.0 + noiseOffset, sin(angle) * 1.0);
const _j258 = noise(cos(angle) * 2.5 + noiseOffset + 100, sin(angle) * 2.5);
const _j259 = noise(cos(angle) * 5.0 + noiseOffset + 200, sin(angle) * 5.0);
const _j260 = _j257 * 0.5 + _j258 * 0.3 + _j259 * 0.2;
const radius = _j254 * (0.4 + _j260 * _j250);
const _j261 = cos(angle) * radius;
const _j262 = sin(angle) * radius;
_j256.push({
x: _j261,
y: _j262
});
}
const _j263 = [];
for (let i = 0; i < _j256.length; i++) {
const _j264 = _j256[(i - 1 + _j256.length) % _j256.length];
const _j265 = _j256[i];
const _j219 = _j256[(i + 1) % _j256.length];
_j263.push({
x: (_j264.x + _j265.x * 2 + _j219.x) / 4,
y: (_j264.y + _j265.y * 2 + _j219.y) / 4
});
}
for (let v of _j263) {
const rotatedX = v.x * cos(layerRotation) - v.y * sin(layerRotation);
const _j266 = v.x * sin(layerRotation) + v.y * cos(layerRotation);
_j246.push({
x: rotatedX + offsetX,
y: _j266 + offsetY
});
}
}
return {
type: 'blob',
vertices: _j246
};
}
function _j14(size, seed) {
randomSeed(seed);
noiseSeed(seed);
const _j246 = [];
const _j247 = 3;
const _j243 = [];
const _j249 = crandom.random(1, 4);
const _j250 = crandom.random(0.15, 0.35);
const _j251 = floor(_j249);
let rotation = crandom.random(TWO_PI);
for (let _j252 = 0; _j252 < _j247; _j252++) {
const _j253 = {
offsetX: crandom.random(-size * 0.2, size * 0.2),
offsetY: crandom.random(-size * 0.2, size * 0.2),
layerRotationOffset: crandom.random(-0.5, 0.5),
sizeVariation: crandom.random(0.85, 1.15),
lengthRatio: crandom.random(1.0, 4.0),
stripWidth: crandom.random(0.5, 0.8),
numVerticesRand: crandom.random(32, 48),
noiseOffset: crandom.random(1000) + _j252 * 500
};
_j243.push(_j253);
}
for (let _j252 = 0; _j252 < _j251; _j252++) {
const _j253 = _j243[_j252];
const offsetX = _j253.offsetX;
const offsetY = _j253.offsetY;
const layerRotation = rotation + _j253.layerRotationOffset;
const sizeVariation = _j253.sizeVariation;
const _j254 = size * sizeVariation;
const lengthRatio = _j253.lengthRatio;
const _j267 = _j254 * lengthRatio;
const stripWidth = _j254 * _j253.stripWidth;
const _j255 = floor(_j253.numVerticesRand);
const noiseOffset = _j253.noiseOffset;
const _j256 = [];
for (let i = 0; i < _j255; i++) {
let _j261, _j262;
if (i < _j255 / 2) {
const _j268 = (i / (_j255 / 2));
_j261 = (_j268 - 0.5) * _j267;
const _j269 = noise(_j268 * 1.5 + noiseOffset, _j252 * 50);
_j262 = -stripWidth / 2 + (_j269 - 0.5) * stripWidth * _j250;
} else {
const _j268 = ((_j255 - 1 - i) / (_j255 / 2));
_j261 = (_j268 - 0.5) * _j267;
const _j269 = noise(_j268 * 1.5 + noiseOffset, 100 + _j252 * 50);
_j262 = stripWidth / 2 + (_j269 - 0.5) * stripWidth * _j250;
}
_j256.push({
x: _j261,
y: _j262
});
}
const _j263 = [];
for (let i = 0; i < _j256.length; i++) {
const _j264 = _j256[(i - 1 + _j256.length) % _j256.length];
const _j265 = _j256[i];
const _j219 = _j256[(i + 1) % _j256.length];
_j263.push({
x: (_j264.x + _j265.x * 2 + _j219.x) / 4,
y: (_j264.y + _j265.y * 2 + _j219.y) / 4
});
}
for (let v of _j263) {
const rotatedX = v.x * cos(layerRotation) - v.y * sin(layerRotation);
const _j266 = v.x * sin(layerRotation) + v.y * cos(layerRotation);
_j246.push({
x: rotatedX + offsetX,
y: _j266 + offsetY
});
}
}
return {
type: 'strip',
vertices: _j246
};
}
function _j15(size, seed) {
randomSeed(seed);
noiseSeed(seed);
let _j246 = [];
const _j270 = 2;
const _j271 = 30;
const _j272 = 8;
const _j273 = 300;
const _j243 = [];
const _j274 = crandom.random(1, 3);
const _j275 = floor(_j274);
for (let _j276 = 0; _j276 < _j270; _j276++) {
const _j277 = {
branchAngle: crandom.random(TWO_PI),
branchOffsetX: crandom.random(-size * 0.2, size * 0.2),
branchOffsetY: crandom.random(-size * 0.2, size * 0.2),
numLRand: crandom.random(0, 1),
numStepsRand: crandom.random(5, 15),
stepSize: size * crandom.random(0.2, 0.35),
noiseScale: crandom.random(0.1, 0.2),
noiseStrength: crandom.random(0.2, 0.4),
thickness: size * crandom.random(0.5, 0.7),
stepRandoms: [],
thicknessRandoms: []
};
for (let step = 0; step < _j271; step++) {
const stepRandoms = {
stepVariation: crandom.random(0.7, 1.3),
subBranchRand: crandom.random(),
subBranchLengthRand: crandom.random(3, 8),
subBranchAngle: crandom.random(-PI / 3, PI / 3)
};
_j277.stepRandoms.push(stepRandoms);
}
for (let i = 0; i < _j273; i++) {
_j277.thicknessRandoms.push(crandom.random(0.9, 1.1));
}
_j243.push(_j277);
}
for (let _j276 = 0; _j276 < _j275; _j276++) {
const _j277 = _j243[_j276];
let branchAngle = _j277.branchAngle;
let branchOffsetX = _j277.branchOffsetX;
let branchOffsetY = _j277.branchOffsetY;
let _j278 = _j277.numLRand > 0.2 ? 1 : 2;
let _j279 = floor(_j277.numStepsRand) * _j278;
let stepSize = _j277.stepSize;
let noiseScale = _j277.noiseScale;
let noiseStrength = _j277.noiseStrength;
let thickness = _j277.thickness;
let pathPoints = [];
let _j280 = branchOffsetX;
let _j281 = branchOffsetY;
let _j282 = branchAngle;
pathPoints.push({
x: _j280,
y: _j281
});
for (let step = 0; step < _j279; step++) {
const stepRandoms = _j277.stepRandoms[step];
const t = step / _j279;
const _j283 = noise(step * noiseScale, seed * 0.01);
const _j284 = noise(step * noiseScale + 100, seed * 0.01);
const angleOffset = (_j283 - 0.5) * PI * noiseStrength;
_j282 += angleOffset;
const stepVariation = stepRandoms.stepVariation;
const _j285 = stepSize * stepVariation;
_j280 += cos(_j282) * _j285;
_j281 += sin(_j282) * _j285;
pathPoints.push({
x: _j280,
y: _j281
});
if (stepRandoms.subBranchRand < 0.1 && step > 3 && step < _j279 - 3) {
const _j286 = floor(stepRandoms.subBranchLengthRand);
const subBranchAngle = _j282 + stepRandoms.subBranchAngle;
let _j287 = _j280;
let _j288 = _j281;
for (let _j289 = 0; _j289 < _j286; _j289++) {
const _j290 = noise(step * noiseScale + _j289 * 0.5, seed * 0.01 + 200);
const _j291 = (_j290 - 0.5) * PI * 0.5;
const _j292 = subBranchAngle + _j291;
_j287 += cos(_j292) * stepSize * 0.6;
_j288 += sin(_j292) * stepSize * 0.6;
pathPoints.push({
x: _j287,
y: _j288
});
}
}
}
const _j293 = [];
const _j294 = [];
for (let i = 0; i < pathPoints.length; i++) {
const point = pathPoints[i];
let _j295;
if (i === 0) {
const _j219 = pathPoints[i + 1];
_j295 = atan2(_j219.y - point.y, _j219.x - point.x) + HALF_PI;
} else if (i === pathPoints.length - 1) {
const _j264 = pathPoints[i - 1];
_j295 = atan2(point.y - _j264.y, point.x - _j264.x) + HALF_PI;
} else {
const _j264 = pathPoints[i - 1];
const _j219 = pathPoints[i + 1];
const _j296 = atan2(point.y - _j264.y, point.x - _j264.x);
const _j297 = atan2(_j219.y - point.y, _j219.x - point.x);
_j295 = ((_j296 + _j297) / 2) + HALF_PI;
}
const _j298 = 0.5 + 0.5 * sin(i / pathPoints.length * PI);
const _j299 = _j277.thicknessRandoms[Math.min(i, _j277.thicknessRandoms.length - 1)];
const _j300 = thickness * _j298 * _j299;
_j293.push({
x: point.x + cos(_j295) * _j300 / 2,
y: point.y + sin(_j295) * _j300 / 2
});
_j294.push({
x: point.x - cos(_j295) * _j300 / 2,
y: point.y - sin(_j295) * _j300 / 2
});
}
for (let v of _j293) {
_j246.push(v);
}
for (let i = _j294.length - 1; i >= 0; i--) {
_j246.push(_j294[i]);
}
}
return {
type: 'lightning',
vertices: _j246
};
}
function _j16(size, seed) {
randomSeed(seed);
noiseSeed(seed);
let _j246 = [];
const _j270 = 3;
const _j271 = 75;
const _j272 = 8;
const _j273 = 800;
const _j243 = [];
const _j274 = crandom.random(1, 4);
const _j275 = floor(_j274);
size = size * 3;
for (let _j276 = 0; _j276 < _j270; _j276++) {
const _j277 = {
branchAngle: crandom.random(TWO_PI),
branchOffsetX: crandom.random(-size * 0.2, size * 0.2),
branchOffsetY: crandom.random(-size * 0.2, size * 0.2),
numLRand: crandom.random(0, 1),
numStepsRand: crandom.random(5, 15),
stepSize: size * crandom.random(0.2, 0.35),
noiseScale: crandom.random(0.1, 0.2) * 0.5,
noiseStrength: crandom.random(0.2, 0.4) * 0.5,
thickness: size * crandom.random(0.5, 0.7) * 0.3,
stepRandoms: [],
thicknessRandoms: []
};
for (let step = 0; step < _j271; step++) {
const stepRandoms = {
stepVariation: crandom.random(0.7, 1.3),
subBranchRand: crandom.random(),
subBranchLengthRand: crandom.random(3, 8),
subBranchAngle: crandom.random(-PI / 3, PI / 3)
};
_j277.stepRandoms.push(stepRandoms);
}
for (let i = 0; i < _j273; i++) {
_j277.thicknessRandoms.push(crandom.random(0.9, 1.1));
}
_j243.push(_j277);
}
for (let _j276 = 0; _j276 < _j275; _j276++) {
const _j277 = _j243[_j276];
let branchAngle = _j277.branchAngle;
let branchOffsetX = _j277.branchOffsetX;
let branchOffsetY = _j277.branchOffsetY;
let _j278 = _j277.numLRand > 0.2 ? 1 : 5;
let _j279 = floor(_j277.numStepsRand) * _j278;
let stepSize = _j277.stepSize;
let noiseScale = _j277.noiseScale;
let noiseStrength = _j277.noiseStrength;
let thickness = _j277.thickness;
let pathPoints = [];
let _j280 = branchOffsetX;
let _j281 = branchOffsetY;
let _j282 = branchAngle;
pathPoints.push({
x: _j280,
y: _j281
});
for (let step = 0; step < _j279; step++) {
const stepRandoms = _j277.stepRandoms[step];
const t = step / _j279;
const _j283 = noise(step * noiseScale, seed * 0.01);
const _j284 = noise(step * noiseScale + 100, seed * 0.01);
const angleOffset = (_j283 - 0.5) * PI * noiseStrength;
_j282 += angleOffset;
const stepVariation = stepRandoms.stepVariation;
const _j285 = stepSize * stepVariation;
_j280 += cos(_j282) * _j285;
_j281 += sin(_j282) * _j285;
pathPoints.push({
x: _j280,
y: _j281
});
if (stepRandoms.subBranchRand < 0.1 && step > 3 && step < _j279 - 3) {
const _j286 = floor(stepRandoms.subBranchLengthRand);
const subBranchAngle = _j282 + stepRandoms.subBranchAngle;
let _j287 = _j280;
let _j288 = _j281;
for (let _j289 = 0; _j289 < _j286; _j289++) {
const _j290 = noise(step * noiseScale + _j289 * 0.5, seed * 0.01 + 200);
const _j291 = (_j290 - 0.5) * PI * 0.5;
const _j292 = subBranchAngle + _j291;
_j287 += cos(_j292) * stepSize * 0.6;
_j288 += sin(_j292) * stepSize * 0.6;
pathPoints.push({
x: _j287,
y: _j288
});
}
}
}
const _j293 = [];
const _j294 = [];
for (let i = 0; i < pathPoints.length; i++) {
const point = pathPoints[i];
let _j295;
if (i === 0) {
const _j219 = pathPoints[i + 1];
_j295 = atan2(_j219.y - point.y, _j219.x - point.x) + HALF_PI;
} else if (i === pathPoints.length - 1) {