-
Notifications
You must be signed in to change notification settings - Fork 0
/
effects.js
2264 lines (1942 loc) · 54.6 KB
/
effects.js
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
//
// Copyright (c) 2014 Zden Hlinka ( Satori, s.r.o. ) - zden@satori.sk - Zd3N.com - satori.sk
// GNU GPL license
//
var color_background = new RGB(0xF0, 0xFF, 0xF0);
var color_background2 = new RGB(0xF0, 0xE8, 0xF0);
var color_black = new RGB(0, 0, 0);
var color_orange = new RGB(0xFF, 0x80, 0);
var color_white = new RGB(0xFF, 0xFF, 0xFF);
var color_red = new RGB(0xff,0,0);
var color_blue = new RGB(0,0,0xff);
var color_pattern;
var color_world = new RGB(0x30, 0x20, 0xA0);
var color_8080FF = new RGB(0x80,0x80,0xff);
var color_FF8000 = new RGB(0xff,0x80,0);
var color_000080 = new RGB(0,0,0x80);
var color_FA0000 = new RGB(0xfa,0,0);
var color_FF00FF = new RGB(0xff,0,0xff);
var color_8080FF = new RGB(0x80,0x80,0xFF);
var color_FF4000 = new RGB(0xff,0x40,0);
var color_FFFF80 = new RGB(0xff,0xff,0x80);
var color_FF0000 = new RGB(0xff,0,0);
var color_FFA000 = new RGB(0xFF, 0xA0, 00);
var color_000080 = new RGB(0,0,0x80);
var color_20A0FF = new RGB(0x20,0xa0,0xff);
var color_800000 = new RGB(0x80,0,0);
var color_0080FF = new RGB(0, 0x80, 0xFF);
var color_A0A0A0 = new RGB(0xA0, 0xA0, 0xA0);
var color_A00000 = new RGB(0xA0,0,0);
var color_FFE0E0 = new RGB(0xff, 0xe0, 0xe0);
var color_8000A0 = new RGB(0x80, 0, 0xa0);
var color_BFBFBF = new RGB(0xbf, 0xbf, 0xbf);
var color_808080 = new RGB(0x80, 0x80, 0x80);
var color_00A0FF = new RGB(0, 0xa0, 0xff);
var color_4397F5 = new RGB(0x43, 0x97, 0xf5);
var color_5495CE = new RGB(0x54, 0x95, 0xce);
var color_66C1F8 = new RGB(0x66, 0xc1, 0xf8);
var color_86D8FE = new RGB(0x86, 0xd8, 0xfe);
var color_A08000 = new RGB(0xA0, 0x80, 00);
var color_FFFF00 = new RGB(0xFF, 0xFF, 00);
var color_F89934 = new RGB(0xF8, 0x99, 0x34);
var color_FFC32D = new RGB(0xFF,0xC3,0x2D);
var color_0014C0 = new RGB(0,20,192);
var color_8014C0 = new RGB(128,20,192);
var color_FF1420 = new RGB(255,20,32);
var color_FF0080 = new RGB(255,0,128);
var color_00809B = new RGB(0,128,155);
var color_FF8020 = new RGB(255,128,32);
var color_FF8080 = new RGB(0xFF,0x80,0x80);
var color_004000 = new RGB(0, 0x40, 0);
var color_0020FF = new RGB(0, 0x20, 0xFF);
var color_FF2000 = new RGB(0xFF, 0x20, 0);
var color_404040 = new RGB(0x40, 0x40, 0x40);
var color_604020 = new RGB(0x60, 0x40, 0x20);
var color_DCC800 = new RGB(220, 200, 0);
var color_0014FF = new RGB(0,20,255);
var color_0080FF = new RGB(0,128,255);
var color_808080_pat = new RGB(0x80,0x80,0x80);
function effects_init()
{
color_pattern = new RGB(0,0,0);
color_pattern.str = pattern_chess;
}
// ### BOX ###
var box_sync = 0, box_stype = 0;
function box_triangle_pulse(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
var mul = 1 + (( (id + ((box_sync/250) % 64)) % 32)/10)*Math.sin((time*id)/1000000);
mul *= (1 + Math.sin(time/2000 + x1 / X_RES)/4);
x1 -= X_MID; x2 -= X_MID; x3 -= X_MID;
y1 -= Y_MID; y2 -= Y_MID; y3 -= Y_MID;
x1 *= mul; x2 *= mul; x3 *= mul;
y1 *= mul; y2 *= mul; y3 *= mul;
x1 += X_MID; x2 += X_MID; x3 += X_MID;
y1 += Y_MID; y2 += Y_MID; y3 += Y_MID;
triangle(context, x1, y1, x2, y2, x3, y3, col, alfa);
}
function box_triangle(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
triangle(context, x1, y1, x2, y2, x3, y3, col, alfa);
}
var box_num = [ -1, -1, -1, -1, -1, -1, -1, -1 ];
var box_pos = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
var box_num_time = 0;
function box_paint()
{
var a;
if (!web_gl && !map_end_img_loaded) return;
clear_canvas(color_background, 1);
put_ch = put_ch_dot;
var t = (Math.floor(timeline_fx_time/200) + rnd(2)) % 4;
if (t == 0)
print_at(context, 0, 0, font6x6, string_fromline(string_box,Math.floor(timeline_fx_time / 200)), color_black, 5+rnd(16)/128, 1, 0);
else
if (t == 1)
print_at(context, X_REL(25), 0, font6x6, string_fromline(string_box,Math.floor(timeline_fx_time / (400+rnd(50)))), color_black, 4+sin(5000,0.5), 0.5, 0);
else
if (t == 2)
print_at(context, X_REL(75)+sin(2500,5), -16+sin(2000,5), font6x6, string_fromline(string_box,Math.floor(timeline_fx_time / (600+sin(3000,200)))), color_black, 3, 0.5, 0);
if (t == 3)
print_at(context, X_REL(90), 0, font6x6, string_fromline(string_box,Math.floor(timeline_fx_time / 800)), color_black, 1.5, 0.15+sin(1000,0.1), 0);
var al = 0, all;
if (timeline_fx_time >= 2000)
{
if (timeline_fx_time > 4000 && box_num_time <= timeline_fx_time)
{
box_next_num();
box_num_time = timeline_fx_time + 750;
}
if (timeline_fx_time < 4000)
al = (timeline_fx_time - 2000)/2000;
else
if (timeline_fx_time > 17750)
{
al = 1 - (timeline_fx_time - 17750)/1000;
if (al < 0) al = 0;
}
else
al = 1;
}
object_buddah.pos_x = 150;
object_buddah.pos_y = 50+sin(4000,10);
object_buddah.pos_z = 40;
object_buddah.ang_x = 4*PI/2;
object_buddah.ang_y = 4*PI/2;
object_buddah.ang_z = PI;
rotate_3d_object(object_buddah);
transform_3d_object(object_buddah);
bounds_3d_object(object_buddah);
flat_render_func = triangle;
var num = object_buddah.face_num, aaa = al*4;
if (aaa > 1) aaa = 1;
object_buddah.face_num = Math.floor(num * al);
flat_3d_simple(object_buddah, color_red, 0.25*al);
var bsync = Math.abs(sin(5000, box_sync) + sin(200, box_sync) + cos(11, box_sync));
for (a = 0; a < object_buddah.vertex_num; a+=3)
object_buddah.point[a].xt += X_RES*0.75 + bsync;//(box_sync != 0 ? rnd(32) : 0);
bounds_3d_object(object_buddah);
flat_3d_simple(object_buddah, color_black, 0.025*al);
object_buddah.face_num = num;
var obj, col, col2, y, b;
for (a = 0; a < 8; a++)
{
if (box_num[a] != -1)
{
if (!box_num[a])
{
obj = object_bin0;
col = col2 = color_black;
y = 14;
}
else
{
obj = object_bin1;
col = color_orange;
col2 = color_red;
y = 0;
}
all = box_pos[a]/16;
if (all > 1) all = 1;
obj.pos_x = 133;
obj.pos_y = -box_pos[a]+y+sin(4000,10);
obj.pos_z = 30;
obj.ang_x = 4*PI/2;
obj.ang_y = 4*PI/2;
obj.ang_z = PI;
rotate_3d_object(obj);
transform_3d_object(obj);
bounds_3d_object(obj);
flat_render_func = triangle;
flat_3d_simple(obj, col, 0.25*al*all);
for (b = 0; b < obj.vertex_num; b++)
{
if (b & 3 == 3)
obj.point[b].xt += X_RES*0.75 +bsync/80;
else
obj.point[b].xt += X_RES*0.70 - bsync/5;
}
bounds_3d_object(obj);
flat_3d_simple(obj, col2, 0.025*al*all);
}
}
rotate_3d_object(object_ball);
rotate_3d_object(object_box);
pat = new RGB(0,0,0);
pat.str = pattern_chess;
object_box.zoom = 4000;
transform_3d_object(object_box);
bounds_3d_object(object_box);
object_smallbox.zoom = 300+box_sync/50;
object_smallbox.pos_z = 200;
rotate_3d_object(object_smallbox);
transform_3d_object(object_smallbox);
bounds_3d_object(object_smallbox);
paint_3d_wire(object_smallbox, 1, pat, 0.67, 0);
image_set_draw(box_glow);
image_draw(context, (canvas.width - 1024)/2, (canvas.height - 1024)/2, 1024, 1024, box_glow, 0.7); //0.7);
image_end_draw();
bounds_3d_object(object_ball);
deform_3d_object(object_ball, timeline_fx_time+box_sync, 8000+sin(5600,box_sync), 1.23+box_sync, 20+box_sync/200, 30+box_sync/300);
object_ball.zoom = 1000 + box_sync/4;
transform_3d_object(object_ball);
bounds_3d_object(object_ball);
if (box_stype)
paint_3d_func = box_triangle_pulse;
else
paint_3d_func = triangle;
if (!hi_det) paint_skip = 2;
if (timeline_fx_time > 15000)
{
c = (timeline_fx_time - 15000)/4000;
if (c > 1) c = 1;
col1 = RGB_cross(color_FF0000, color_0080FF, c);
col2 = RGB_cross(color_DCC800, color_0014FF, c);
col3 = RGB_cross(color_FFA000, new RGB(0x60,0x9A,0xD5), c);
}
else
{
col1 = color_FF0000;
col2 = color_DCC800;
col3 = color_FFA000;
}
paint_3d_object(object_ball, col1, col2, col3);
paint_skip = 1;
paint_3d_line_move(object_ball, timeline_fx_time, 1000, 20 + (!hi_det ? 30 : 0) - (web_gl ? 5 : 0));
paint_3d_wire(object_box, 96+(Math.floor(time/560))%16, color_004000, 0.15, 1);
}
function box_next_num()
{
for (a = 0; a < 7; a++)
{
box_num[a] = box_num[a+1];
box_pos[a] = box_pos[a+1];
}
box_num[7] = rnd(2) ? 1 : 0;
box_pos[7] = 0;
}
function box_pump(time, dur)
{
box_sync = 4096 - (4096*time)/dur;
box_stype = 0;
}
function box_pump2(time, dur)
{
box_sync = 4096 - (4096*time)/dur;
box_stype = 1;
}
function box_pump_end()
{
box_sync = 0;
}
function box_move(move)
{
object_smallbox.pos_z = object_box.pos_z = object_ball.pos_z = 100;
object_smallbox.pos_y = cos(100, box_sync/4000);
object_box.pos_y = 0;
object_ball.pos_y = sin(1000-box_sync/10, box_sync/800);
object_box.ang_y = object_ball.ang_y = time / 9000;
object_smallbox.ang_y = - time / 9000;
object_box.ang_z = object_ball.ang_z = time / 12000;
object_ball.ang_y = box_sync / 3000;
object_ball.ang_x = time / 1200;
object_smallbox.ang_z =time / 12000;
object_smallbox.ang_x = (box_stype ? 1 : -1) * box_sync / 5000;
if (timeline_fx_time > 18000)
{
c = (timeline_fx_time - 18000)/20;
object_ball.pos_z -= c;
object_smallbox.pos_z -= c;
object_box.pos_z -= c;
object_ball.ang_z += move/20;
}
for (a = 0; a < 8; a++)
if (box_num[a] != -1)
box_pos[a] += move/50;
}
// ### BTC ###
function btc_callback(x,y)
{
}
function btc_color_func(np)
{
if (np.z == 0)
return(color_FF8000);
else
if (np.x == 0)
return(color_FFFF00);
else
if (np.y == 0)
return(color_A08000);
else
return(color_FFA000);
}
function hexa_triangle(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
xd = X_MID - x1;
yd = Y_MID - y1;
dist = Math.sqrt(xd*xd + yd*yd);
if (dist < 100)
{
triangle(context, x1, y1, x2, y2, x3, y3, color_0014C0, alfa, id);
}
else
if (dist < 200)
{
triangle(context, x1, y1, x2, y2, x3, y3, color_8014C0, alfa, id);
}
else
if (dist < 300)
{
triangle(context, x1, y1, x2, y2, x3, y3, color_FF1420, alfa, id);
}
else
triangle(context, x1, y1, x2, y2, x3, y3, color_red, alfa, id);
}
function btc_paint()
{
if (timeline_fx_time < 2000)
al = 0.9*timeline_fx_time/2000;
else
al = 0.9;
clear_canvas(color_background, al);
// - gox
if (btc_gox.ready && timefx_less(sec(7)))
{
al = 1 - (timeline_fx_time / 7000);
items = btc_gox.array.length - 1;
items_paint = Math.floor((350*timeline_fx_time)/2000);
items = 350;
div = 3000 - timeline_fx_time/1.5;
if (div < 5) div = 5;
div2 = div/4;
div3 = div/1000;
xp = -1;
sk = (hi_det ? 1 : 4);
for (a = 0; a < items; a += sk)
{
x = (a * X_RES) / items;
y = btc_gox.array[items-a][7];
y = Y_RES-(Y_RES * y) / div;
if (a < items_paint)
{
if (xp != -1)
line(context, xp, yp, x, y, color_black, 0.5*al, LINE_2);
line(context, xp, Y_RES, xp, Y_RES - btc_gox.array[items-a][5]/div2, color_808080, 0.25*al, LINE_2);
if (hi_det) triangle(context, xp, Y_RES, xp, Y_RES - btc_gox.array[items-a][2]/div3, x, Y_RES, color_orange, 0.5*al);
}
xp = x;
yp = y;
}
}
rotate_3d_object(object_btc);
transform_3d_object(object_btc);
bounds_3d_object(object_btc);
flat_render_func = triangle;
flat_callback = btc_callback;
flat_color_func = btc_color_func;
if (!hi_det) flat_hor_start = -0.15;
flat_3d_object(object_btc, COL_FUNC | ALFA | ALFA_REV);
flat_hor_start = 0;
paint_3d_wire_hor(object_btc, 1+(hi_det ? 0 : 8), color_red, 0.05, 0);
if (timeline_fx_time > 6500)
{
al = timeline_fx_time - 6500;
al /= 2000;
if (al > 1) al = 1;
object_btc.pos_x = -12+(1-al)*-5;
object_btc.pos_y = 3;
object_btc.pos_z = 4+rnd(32)/1024;
object_btc.ang_x = PI/2;
object_btc.ang_y = 0;
object_btc.ang_z = PI;
rotate_3d_object(object_btc);
transform_3d_object(object_btc);
bounds_3d_object(object_btc);
paint_3d_wire_hor(object_btc, 1+rnd(8)+(hi_det ? 0 : 4), (rnd(2) == 1 ? color_white: color_black), (0.075+rnd(8)/256)*al, 0);
}
if (timefx_more(sec(2)))
{
flat_render_func = hexa_triangle;
rotate_3d_object(object_hexa);
bounds_3d_object(object_hexa);
transform_3d_object(object_hexa);
al = sec_dif(2)/100000;
if (al > 1) al = 1;
if (!hi_det) flat_hor_start = -40;
flat_3d_simple(object_hexa, color_red, al*0.75);
flat_hor_start = 0;
}
if (timefx_more(sec(4)))
{
al = sec_dif(4)/2000;
if (al > 1) al = 1;
put_ch = put_ch_dot;
print_at(context, 70, Y_RES-100, font6x6, string_satoshi, color_black, 2.7, al*1, 0);
}
}
function btc_move(move)
{
object_btc.pos_z = 2-Math.abs(Math.sin(timeline_fx_time/3000))*2;
object_btc.pos_x = object_btc.pos_y = 0;
object_btc.ang_x = PI/2;
object_btc.ang_z = PI+Math.sin(timeline_fx_time / 1000)/3;
if (timeline_fx_time > 5000)
object_btc.ang_y = Math.sin((timeline_fx_time - 5000)/6455);
else
object_btc.ang_y = 0;
//
object_hexa.pos_x = 0;
object_hexa.pos_y = 0;
object_hexa.pos_z = 100-timeline_fx_time/100;
object_hexa.ang_x = 0;
object_hexa.ang_y = 0;
object_hexa.ang_z = 0;
}
// ### NETHEMBA ###
function nethemba_flat_color(np)
{
if (np.z == 0)
return(color_4397F5);
else
if (np.x == 0)
return(color_5495CE);
else
if (np.y == 0)
return(color_66C1F8);
else
return(color_86D8FE);
}
var NETHEMBA_POINTS = 200;
var nethemba_point_list = new Array(NETHEMBA_POINTS*2);
var nethemba_face_pos = new Array(256);
function nethemba_flat_logo(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
add = nethemba_face_pos[id & 0xff];;
alfa = alfa - (add/200);
if (alfa < 0) alfa = 0;
if (id & 1)
add *= -1;
triangle_pattern(context, x1, y1-add, x2, y2-add*2, x3, y3-add*3, pattern_chess, alfa);
}
function nethemba_flat_logo2(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
add = nethemba_face_pos[id & 0xff];;
if (id & 1)
add *= -1;
triangle_pattern(context, x1-add, y1, x2+add, y2, x3-add*2, y3, pattern_chess, alfa);
}
function nethemba_flat_pulse(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
var mul = 1 + (( (id + ((time/250) % 16)) % 8)/10)*Math.sin((time*id)/1000000);
mul *= (1 + Math.sin(time/5000 + x1 / X_RES)/4);
x1 -= X_MID; x2 -= X_MID; x3 -= X_MID;
y1 -= Y_MID; y2 -= Y_MID; y3 -= Y_MID;
x1 *= mul; x2 *= mul; x3 *= mul;
y1 *= mul; y2 *= mul; y3 *= mul;
x1 += X_MID; x2 += X_MID; x3 += X_MID;
y1 += Y_MID; y2 += Y_MID; y3 += Y_MID;
alfa *= (mul % 1);
add = nethemba_face_pos[id & 0xff];;
triangle(context, x1, y1-add, x2, y2-add, x3, y3-add, col, alfa);
}
function nethemba_add_point(id, x, y)
{
if (x < 0 || x > X_RES) return;
id %= (NETHEMBA_POINTS - 1);
id &= 0xfffe;
nethemba_point_list[id] = x;
nethemba_point_list[id+1] = y;
}
function nethemba_paint()
{
clear_canvas(color_background, 0.9);
//
if (timefx_less(26000))
{
for (a = 0; a < 256; a++)
{
nethemba_face_pos[a] = 1400 + Math.sqrt(a*a)*3.1415926;
nethemba_face_pos[a] -= timeline_fx_time/8;
if (nethemba_face_pos[a] < 0) nethemba_face_pos[a] = 0;
}
}
else
{
for (a = 0; a < 256; a++)
{
nethemba_face_pos[a] = a/10 + (a/10)*Math.sin(timeline_fx_time/100*a+1);
nethemba_face_pos[a] -= (timeline_fx_time - 26000)/16;
if (nethemba_face_pos[a] < 0) nethemba_face_pos[a] = 0;
}
}
context.globalAlpha = 1;
rotate_3d_object(object_text_nethemba);
transform_3d_object(object_text_nethemba);
bounds_3d_object(object_text_nethemba);
rotate_3d_object(object_text_nethemba_flat);
transform_3d_object(object_text_nethemba_flat);
bounds_3d_object(object_text_nethemba_flat);
obj = object_text_nethemba_flat;
var aa = 0;
if (timeline_fx_time < 25000)
aa = (0.1*timeline_fx_time) / 25000;
else
aa = 0.1;
var sh = 1;
if (timeline_fx_time < sec(15))
sh = 1 + (sec(15) - timeline_fx_time) / 1000;
image_set_draw(img_b);
if (hi_det)
for (a = 0; a < obj.face_num; a += 2)
{
al = (aa*(obj.point[obj.face[a].a].yt & 0xf))/0xf;
context.globalAlpha = al;
xt = obj.point[obj.face[a].a].xt - 64;
yt = obj.point[obj.face[a].a].yt - 64;
xt = (xt - X_MID)*sh + X_MID;
yt = (yt - Y_MID)*sh + Y_MID;
image_draw(context, xt, yt, 128, 128, img_b, al);
}
image_end_draw();
flat_render_func = nethemba_flat_pulse;
flat_callback = nethemba_add_point;
flat_color_func = nethemba_flat_color;
if (!hi_det) flat_skip = 2;
flat_3d_object(object_text_nethemba, ALFA | ALFA_REV | COL_FUNC);
flat_skip = 1;
x = y = xp = yp = -1;
c = NETHEMBA_POINTS-6;
if (!hi_det) { al = 0.025; c >>= 2; } else al = 0.05;
for (a = 0; a < c; a += 4)
{
x = nethemba_point_list[a];
y = nethemba_point_list[a+1];
x2 = nethemba_point_list[a+3];
y2 = nethemba_point_list[a+2];
x3 = nethemba_point_list[a+4];
y3 = nethemba_point_list[a+5];
add = nethemba_face_pos[a & 0xff]/5;
triangle(context, x, y+add, x2, y2+add, x3, y3+add, color_FF8000, al);
x2 = x + (x-X_MID)*(1+(x3-X_MID)/100);
y2 = y + (y-Y_MID)*(1+(y3-Y_MID)/100);
line(context, x-add, y+add*2, x2+add, y2-add*2, color_FFA000, 0.15, 0.4);
}
line_paint_buffer();
triangle_paint_buffer_gl();
if (timefx_less(26000))
flat_render_func = nethemba_flat_logo;
else
flat_render_func = nethemba_flat_logo2;
flat_3d_simple(object_text_nethemba_flat, color_FF8000, 1);
if (hi_det && timefx_more(sec(15)) && timefx_less(sec(34)))
{
al = 1;
if (timeline_fx_time > 33000)
{
al = 1 - (timeline_fx_time - 33000)/1000;
}
t = timeline_fx_time - 15000;
if (t > 2000 && rnd(16) == 8)
str = string_flash(string_intro, t, 50);
else
str = string_sequence(string_intro, t, 40);
put_ch = put_ch_dot;
print_at(context, X_REL(1), Y_REL(85), font6x6, str, color_black, 2, al, rnd(8+rnd(8)) == 4);
}
}
function nethemba_move(move)
{
var z = 0;
if (timeline_fx_time < 15000)
z = 100 - timeline_fx_time/150;
object_text_nethemba_flat.pos_z = object_text_nethemba.pos_z = 50+z+1.5+Math.sin(timeline_fx_time / 3000)*1;
object_text_nethemba_flat.pos_x = object_text_nethemba.pos_x = Math.sin(3+timeline_fx_time / 4000)*100;
object_text_nethemba_flat.pos_y = object_text_nethemba.pos_y = 0;
object_text_nethemba.ang_y = Math.sin(5+timeline_fx_time / 3000)/10;
object_text_nethemba.ang_x = 3.14/2+3.14;
object_text_nethemba.ang_z = 3.14+Math.sin(timeline_fx_time / 2000)/5;
object_text_nethemba_flat.ang_y = Math.sin(5+timeline_fx_time / 3000)/10;
object_text_nethemba_flat.ang_x = 3.14/2+3.14;
object_text_nethemba_flat.ang_z = 3.14+Math.sin(timeline_fx_time / 2000)/5;
if (timeline_fx_time > sec(28))
{
object_text_nethemba_flat.pos_x += sec_dif(28)/42; // 40
object_text_nethemba_flat.pos_y -= sec_dif(28)/300;
}
}
var nethemba_end_img;
var nethemba_end_img_loaded = 0;
function nethemba_end()
{
if (!web_gl)
{
nethemba_end_img = new Image();
nethemba_end_img.src = canvas.toDataURL("image/raw");
nethemba_end_img.onload = function func() { nethemba_end_img_loaded = 1; };
}
else
swap_framebuffer_gl();
}
function nethemba_fade(time, dur)
{
yt = time/1.777;
if (!web_gl)
{
if (!nethemba_end_img_loaded) return;
context.globalAlpha = 1 - time/dur;
context.drawImage(nethemba_end_img, 0, 0, X_RES, Y_RES, -time/10, -yt/10, X_RES+time/5, Y_RES+yt/5);
}
else
paint_fade_texture_gl(0, 0, X_RES, Y_RES, -time/10, -yt/10, X_RES+time/5, Y_RES+yt/5, 1 - time/dur);
}
////////////////////
/// medusa
function medusa_deform(obj)
{
for (a = 0; a < obj.vertex_num; a++)
{
if (obj.point[a].rx > 0)
{
obj.point[a].ry += sin(3000, 2*obj.point[a].rz/10)+cos(10+a/1.5, 2*obj.point[a].rx/30) + cos(3333, 1.5*obj.point[a].rz/13.3)+sin(6.66+a, 1.0*obj.point[a].rx/44);
obj.point[a].rx += Math.abs( sin(3000, 0.5*obj.point[a].rx/100)+cos(10+a/1.5, 0.25*obj.point[a].rz/300) + cos(3333, 0.5*obj.point[a].rx/10)+sin(6.66+a, 0.25*obj.point[a].rz/440) );
}
else
obj.point[a].rx += Math.abs( sin(3000, 15*obj.point[a].rx/100)+cos(10+a/1.5, 0.25*obj.point[a].rz/300) + cos(3333, 0.5*obj.point[a].rx/10)+sin(6.66+a, 0.25*obj.point[a].rz/440) );
obj.point[a].ry += Math.abs( sin(3000, 2*obj.point[a].rz/10)+cos(10+a/1.5, 2*obj.point[a].rx/30) + cos(3333, 1.5*obj.point[a].rz/13.3)+sin(6.66+a, 1.0*obj.point[a].rx/44) );
}
}
function medusa_flat(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
if (x1 > X_MID-128 && x1 < X_MID+192)
{
if (x1 > X_MID-32 && x1 < X_MID+128)
col = color_FF8000; //A0A0FF";
triangle(context, x1, y1, x2, y2, x3, y3, col, alfa);
}
}
function medusa_paint(fx_start)
{
tt = time - fx_start;
rotate_3d_object(object_medusa);
medusa_deform(object_medusa);
transform_3d_object(object_medusa);
transform_shift(object_medusa, -X_RES/3 + tt / 4, sin(3000,12)+cos(1500,13));
bounds_3d_object(object_medusa);
paint_blob(object_medusa, img_blob, 0.45, 8+(!hi_det ? 100 : 0));
paint_3d_wire(object_medusa, 1+(!hi_det ? 15 : 0), color_FF00FF, 0.025+(!hi_det ? 0.3 : 0), 0);
flat_render_func = medusa_flat;
if (!hi_det) flat_hor_start = -1;
flat_3d_simple(object_medusa, color_8080FF, 0.25);
flat_hor_start = 0;
}
function medusa_move(move)
{
object_medusa.ang_z = -PI/2+cos(3000,0.1);
object_medusa.ang_y += move/5000;
object_medusa.pos_z = 35;
object_medusa.pos_y = -5
}
// rove
function rove_flat(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
g = id & 0xff;
col = new RGB(g, g >> 2, 0);
x1 += sin(300, x2/50);
triangle(context, x1, y1, x2, y2, x3, y3, col, alfa);
}
function rove_paint()
{
rotate_3d_object(object_rove);
medusa_deform(object_rove);
transform_3d_object(object_rove);
bounds_3d_object(object_rove);
if (hi_det)
{
paint_blob(object_rove, img_blob, 1, 8);
paint_3d_wire(object_rove, 1, color_FF00FF, 0.025, 0);
}
flat_render_func = rove_flat;
if (!hi_det) flat_hor_start = -5;
flat_3d_simple(object_rove, color_8080FF, 0.25);
flat_hor_start = 0;
}
function rove_move(move)
{
object_rove.ang_z = -PI/2+cos(3000,0.2);
object_rove.ang_x = PI/2;
object_rove.ang_y += move/10000;
object_rove.ang_z += move/100;
object_rove.pos_z = 10;
object_rove.pos_y = -5
}
// wir
function wir_paint()
{
rotate_3d_object(object_wir);
bounds_3d_object(object_wir);
deform_3d_object(object_wir, timeline_fx_time, 8000+cos(5600,1000), 100.23+100, 200+1/200, 300+1/30);
transform_3d_object(object_wir);
if (!hi_det) flat_hor_start = -100;
flat_render_func = triangle;
flat_3d_simple(object_wir, color_FF8000, 0.4);
flat_hor_start = 0;
}
function wir_paint2(time_start, dist, alfa)
{
object_wir.pos_y = 0;
object_wir.pos_x = 0;
object_wir.ang_x = PI/2+sin(3777, 0.5);
object_wir.ang_z = -PI/2+sin(6000,1);
object_wir.ang_y = PI;
object_wir.pos_z = 250-(dist << 2);
rotate_3d_object(object_wir);
bounds_3d_object(object_wir);
deform_3d_object(object_wir, timeline_fx_time, 8000+cos(5600,1000), 100.23+100, 200+1/200, 300+1/30);
transform_3d_object(object_wir);
flat_render_func = triangle;
flat_hor_start = -1100+(time-time_start)/40+(dist << 2);
flat_3d_simple(object_wir, color_FF4000, 0.4*alfa);
flat_hor_start -= 150+(dist << 2);
flat_3d_simple(object_wir, color_FFFF80, 0.4*alfa);
flat_hor_start = 0;
}
function wir_move(move)
{
object_wir.pos_y = 200;
object_wir.pos_x = 0;
object_wir.ang_x = PI/2;
object_wir.ang_z = -PI/2+sin(3000,0.2);
object_wir.ang_y = PI;
object_wir.pos_z = 250;
}
function wir_move2(move, dist)
{
object_wir.pos_y = -250;
object_wir.pos_x = 250;
object_wir.ang_x = 0.1;
object_wir.ang_z = -PI/2+sin(3000,0.2);
object_wir.ang_y = PI/2-0.2;
object_wir.pos_z = 100;
}
// kula
var kula_max_dist;
function kula_render_flat(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
dist = Math.sqrt((X_MID-x1)+(X_MID-x1)+(Y_MID-y1)*(Y_MID-y1));
if (dist < kula_max_dist)
{
if (id & 0x8)
triangle_pattern(context, x1, y1, x2, y2, x3, y3, color_pattern, alfa);
else
triangle(context, x1, y1, x2, y2, x3, y3, id & 0x4 ? color_FFA000 : col, alfa);
}
}
function kula_paint(fx_time)
{
kula_max_dist = (timeline_fx_time-fx_time)/2;
rotate_3d_object(object_kula);
bounds_3d_object(object_kula);
transform_3d_object(object_kula);
flat_render_func = kula_render_flat;
flat_3d_simple(object_kula, color_red, 0.7);
}
function kula_move(move)
{
object_kula.pos_z = 10;
object_kula.pos_y = object_kula.pos_x = 0;
object_kula.ang_x = PI/2+ cos(4000,1);
object_kula.ang_z = -PI/2+sin(3000,1);
object_kula.ang_y = PI;
}
// circle
function circle_render_flat(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
if (id & 0x8)
triangle_pattern(context, x1, y1, x2, y2, x3, y3, color_pattern, alfa);
else
triangle(context, x1, y1, x2, y2, x3, y3, id & 0x4 ? color_FFA000 : col, alfa);
}
function circle_render_flat_low(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
triangle(context, x1, y1, x2, y2, x3, y3, id & 0x8 ? color_808080 : id & 0x4 ? color_FFA000 : col, alfa);
}
function circle_paint(fx_time)
{
rotate_3d_object(object_circle);
bounds_3d_object(object_circle);
transform_3d_object(object_circle);
if (hi_det)
flat_render_func = circle_render_flat;
else
flat_render_func = circle_render_flat_low;
if (timeline_fx_time < 6000)
al = 0.5;
else
al = 0.5 * (1 - ((timeline_fx_time - 6000)/1500));
if (!hi_det)
{
flat_skip = 2;
flat_hor_start = -1;
}
flat_3d_simple(object_circle, color_FF0000, al);
flat_skip = 1;
flat_hor_start = 0;
}
function circle_move(move)
{
object_circle.pos_z = 12+sin(10000,10);
object_circle.pos_y = object_circle.pos_x = 0;
object_circle.ang_x = PI/2+ cos(4000,0.1);
object_circle.ang_z = -PI/2+sin(3000,0.1);
object_circle.ang_y = PI;
}
///////////////// CALM
var whiz_pos = 0;
var calm_fade_type = 0;
function whiz_triangle(context, x1, y1, x2, y2, x3, y3, col, alfa, id)
{
if ((id & 0x7) == whiz_pos)
{
triangle(context, x1+rnd(256)-128, y1, x2+sin(2000,200), y2, x3, y3, color_FF0080, alfa, id);
}
x2 += -32+rnd(64);
x3 += -32+rnd(64);
if (id & 0x2)
triangle(context, x1, y1, x2, y2, x3, y3, color_00809B, alfa/2, id);
if (!(id % 9))
triangle(context, x1, y1, x2, y2, x3, y3, color_FF8020, alfa, id);
}
var calm_type = 0;
function calm_paint()
{
if (calm_type)
{
tunel_paint();
return;
}
clear_canvas(color_background, 0.1);
aa = timeline_fx_time/2;
for (c = 0; c < 16; c++)
{
for (x = 16; x < X_RES - 16 + c*32; x += 256)
line(context, x+c*16-aa, aa, x+c*8+aa, Y_RES-1-x/2, color_white, x/X_RES, 1);
for (y = 16; y < X_RES - 16 + c*32; y += 256)
line(context, -aa, y+c*16, X_RES-1-y/2+c*26, y-c*8-aa, color_white, y/Y_RES, 1);
}
line_paint_buffer();
xx = X_RES-100;
y = Y_RES-aa/3.5;
if (y >= Y_MID-256 && y <= Y_MID+256)
{
a = 1-(Math.abs(Y_MID-y)/256)
}
else