-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
654 lines (568 loc) · 30 KB
/
index.html
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
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'/>
<meta name='viewport' content='width=device-width, initial-scale=1.0'/>
<title>LOFIAFGAME</title>
<style>
body {
background: black;
font-family: 'Barlow Semi Condensed', sans-serif;
color: white;
> section {
opacity: 0;
position: absolute;
inset: 0;
overflow: auto;
transition: opacity 1s ease-in;
animation: none;
}
}
</style>
<!-- icon FIXME -->
<link rel='shortcut icon' href='assets/car/porsche.png' type='image/x-icon'/>
<!-- styles -->
<link rel='stylesheet' href='css/screens.css'/>
<link rel='stylesheet' href='css/ui.css'/>
<link rel='stylesheet' href='css/style.css'/>
<link rel='stylesheet' href='css/debug.css'/>
<!-- G fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:ital,wght@0,400;0,500;1,300;1,400&display=swap" rel="stylesheet">
<!-- G icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="js/lib/tuna-1.0.1-min.js" type="text/javascript"></script>
</head>
<body data-state="splash" data-fps="0">
<section id="splash">
<div class='preloader'>
<svg width="171.4" height="133.7" viewBox="0 0 171.4 133.7" version="1.1" id="svg5" xmlns="http://www.w3.org/2000/svg" title=""LFO industries>
<path id="path53922" style="fill:#ffffff;stroke-width:10.0023;stroke-linecap:square;paint-order:fill markers stroke" d="M 90.8 113.9 L 88.1 123 C 88 122.3 87.7 121.7 87.3 121.2 C 86.8 120.6 86.2 120.2 85.5 119.9 C 84.8 119.5 84 119.4 83.1 119.4 C 82.1 119.4 81.1 119.6 80.2 120 C 79.2 120.4 78.4 120.9 77.6 121.6 C 77 122.3 76.4 123.1 75.9 124 C 75.3 124.9 75 125.9 74.9 126.9 C 74.7 128.2 74.9 129.4 75.3 130.4 C 75.7 131.4 76.4 132.2 77.2 132.8 C 78.2 133.3 79.3 133.6 80.6 133.6 C 81.9 133.6 83.1 133.4 84.2 132.8 C 85.4 132.3 86.3 131.4 87.1 130.5 C 88 129.4 88.6 128.2 88.9 126.8 L 92.7 113.9 L 90.8 113.9 Z M 41.6 114.4 C 40.1 114.4 38.7 114.6 37.4 115.1 C 36.1 115.6 34.8 116.4 33.6 117.3 C 32.6 118.2 31.7 119.3 30.9 120.6 C 30.2 121.8 29.7 123.2 29.6 124.7 C 29.4 125.9 29.5 127.1 29.8 128.2 C 30.1 129.3 30.7 130.2 31.3 131.1 C 32.1 131.8 33 132.5 34.1 133 C 35.3 133.4 36.5 133.6 37.9 133.6 C 39.4 133.6 40.8 133.4 42.2 132.9 C 43.6 132.4 44.8 131.6 45.9 130.7 C 46.9 129.8 47.9 128.7 48.5 127.5 C 49.2 126.2 49.7 124.8 49.9 123.3 C 50.1 122.1 50 120.9 49.7 119.8 C 49.3 118.7 48.8 117.8 48.1 117 C 47.5 116.2 46.5 115.5 45.4 115 C 44.3 114.6 43 114.4 41.6 114.4 L 41.6 114.4 Z M 57.9 114.6 C 57.6 114.6 57.4 114.7 57.1 114.8 C 56.9 114.9 56.7 115.1 56.5 115.3 C 56.3 115.6 56.3 115.8 56.3 116 C 56.3 116.4 56.3 116.6 56.4 116.9 C 56.7 117.1 57 117.3 57.4 117.3 C 57.6 117.3 57.8 117.2 58 117.1 C 58.3 117 58.5 116.8 58.6 116.6 C 58.8 116.4 59 116.2 59 115.9 C 59 115.5 59 115.2 58.7 115 C 58.5 114.7 58.2 114.6 57.9 114.6 L 57.9 114.6 Z M 144.7 114.6 C 144.4 114.6 144.2 114.7 143.9 114.8 C 143.9 114.9 143.6 115 143.5 115.3 L 143.4 116 C 143.4 116.4 143.3 116.6 143.3 116.9 C 143.5 117.1 143.9 117.3 144.3 117.3 C 144.6 117.3 144.9 117.2 145.1 117.1 C 145.4 117 145.5 116.8 145.5 116.6 C 145.8 116.4 146 116.2 146 115.9 C 146.1 115.5 146 115.2 145.8 115 C 145.5 114.7 145.2 114.6 144.7 114.6 L 144.7 114.6 Z M 4.2 114.7 L 0.8 126.5 C 0.7 126.8 0.6 127.1 0.5 127.5 C 0.4 127.9 0.3 128.3 0.3 128.7 C 0.2 129.6 0.3 130.4 0.5 131.1 C 0.8 131.8 1.3 132.3 2 132.7 C 2.7 133.1 3.6 133.3 4.7 133.3 L 10.7 133.3 L 12.1 128.8 L 7.1 128.8 C 6.7 128.8 6.5 128.7 6.3 128.6 C 6.1 128.4 6.1 128.2 6.1 127.9 C 6.1 127.8 6.1 127.7 6.2 127.5 C 6.2 127.4 6.3 127.3 6.4 127.1 L 10 114.7 L 4.2 114.7 Z M 22.9 114.7 C 21.3 114.7 19.9 115.1 18.7 116 C 17.5 116.8 16.7 118 16.3 119.5 L 12.3 133.3 L 18 133.3 L 19.8 126.9 L 26.8 126.9 L 28.1 122.5 L 21.1 122.5 L 21.7 120.5 C 21.8 120.1 22 119.8 22.4 119.6 C 22.7 119.3 23 119.2 23.4 119.2 L 29.8 119.2 L 31.2 114.7 L 22.9 114.7 Z M 125.9 116.4 L 124.9 119.7 L 122.5 119.7 L 122 121.4 L 124.4 121.4 L 122.1 129.3 C 122 129.6 121.9 129.9 121.9 130.2 C 121.8 131.1 121.9 131.9 122.4 132.5 C 122.9 133.1 123.8 133.3 124.8 133.3 L 127.8 133.3 L 128.3 131.7 L 125.5 131.7 C 124.8 131.7 124.4 131.5 124.1 131.2 C 123.9 130.9 123.8 130.4 123.9 129.8 C 123.9 129.6 124 129.3 124.1 129 L 126.3 121.4 L 131.3 121.4 L 131.8 119.7 L 126.8 119.7 L 127.7 116.4 L 125.9 116.4 Z M 40.8 119 C 41.4 119 42.1 119.2 42.6 119.5 C 43.2 119.9 43.6 120.4 43.9 121 C 44.2 121.7 44.2 122.5 44.1 123.5 C 44 124.3 43.8 124.9 43.5 125.6 C 43.2 126.3 42.8 126.9 42.3 127.3 C 41.8 127.9 41.2 128.3 40.6 128.6 C 40 128.8 39.4 129 38.7 129 C 38 129 37.4 128.8 36.8 128.5 C 36.3 128.1 35.9 127.6 35.6 126.9 C 35.3 126.3 35.3 125.5 35.4 124.5 C 35.5 123.7 35.7 123 36 122.4 C 36.3 121.7 36.7 121.1 37.2 120.6 C 37.6 120.1 38.1 119.7 38.8 119.4 C 39.4 119.1 40 119 40.8 119 L 40.8 119 Z M 67.1 119.4 C 66 119.4 64.9 119.6 63.9 120.1 C 62.9 120.6 62 121.2 61.3 122.1 C 60.5 122.9 59.9 124 59.5 125.3 L 57.2 133.3 L 59.1 133.3 L 61.4 125.4 C 61.7 124.4 62.1 123.6 62.7 122.9 C 63.2 122.3 63.9 121.8 64.6 121.5 C 65.3 121.1 66 121 66.8 121 C 68 121 69 121.4 69.7 122.1 C 70.3 122.9 70.6 123.9 70.4 125 C 70.4 125.2 70.4 125.3 70.3 125.5 C 70.3 125.6 70.3 125.8 70.2 126 L 68 133.3 L 69.9 133.3 L 72 126 C 72 125.8 72.1 125.6 72.1 125.5 C 72.1 125.3 72.2 125.1 72.2 124.9 C 72.4 123.9 72.2 122.9 71.9 122.1 C 71.5 121.2 71 120.6 70.1 120.2 C 69.3 119.6 68.3 119.4 67.1 119.4 L 67.1 119.4 Z M 153.9 119.5 C 152.9 119.6 151.8 119.7 151 120 C 148 121.2 145.7 124.4 145.3 127.3 C 145 129.8 146.3 131.9 148.3 132.7 C 149.2 133.1 150.4 133.3 151.9 133.3 L 154.5 133.3 L 155 131.7 L 152.1 131.7 C 149.7 131.7 147.7 130.8 147.4 128.5 C 148.9 128.6 150.5 128.5 151.8 128.1 C 153.8 127.6 156 126.8 157.4 125.3 C 157.9 124.6 158.3 123.8 158.4 122.9 C 158.6 121.2 157.6 120.3 156.6 119.9 C 155.9 119.6 155 119.5 153.9 119.5 L 153.9 119.5 Z M 55.6 119.7 L 51.7 133.3 L 53.5 133.3 L 57.4 119.7 L 55.6 119.7 Z M 94.7 119.7 L 92.5 127 L 92.4 127.6 C 92.4 127.8 92.4 127.9 92.3 128.1 C 92.1 129.2 92.3 130.1 92.6 131 C 93 131.8 93.5 132.5 94.3 133 C 95.2 133.4 96.1 133.6 97.4 133.6 C 98.5 133.6 99.7 133.4 100.7 133 C 101.7 132.5 102.6 131.8 103.3 131 C 104.2 130.1 104.6 129 105 127.8 L 107.3 119.7 L 105.5 119.7 L 103.2 127.6 C 102.9 128.6 102.5 129.4 101.9 130.1 C 101.3 130.8 100.6 131.2 99.9 131.5 C 99.3 131.9 98.5 132 97.8 132 C 96.5 132 95.5 131.6 94.9 130.9 C 94.3 130.1 94 129.2 94.1 128 C 94.1 127.8 94.2 127.7 94.3 127.5 C 94.3 127.4 94.4 127.2 94.4 127.1 L 96.5 119.7 L 94.7 119.7 Z M 114.1 119.7 C 113.2 119.7 112.3 119.9 111.7 120.3 C 111 120.7 110.5 121.2 110 121.8 C 109.6 122.4 109.4 123 109.3 123.7 C 109.2 124.3 109.3 124.9 109.5 125.4 C 109.7 125.9 110.1 126.3 110.6 126.6 C 111.2 126.9 111.9 127.1 112.7 127.1 L 114.9 127.1 C 115.7 127.1 116.3 127.3 116.6 127.7 C 116.9 128.1 117 128.5 117 129.1 C 116.9 129.5 116.7 129.9 116.5 130.4 C 116.2 130.8 115.8 131.1 115.5 131.3 C 115 131.6 114.5 131.7 113.9 131.7 L 107.3 131.7 L 106.8 133.3 L 113.6 133.3 C 114.6 133.3 115.4 133.1 116.2 132.7 C 116.9 132.2 117.5 131.7 118 131 C 118.4 130.3 118.7 129.6 118.9 128.8 C 119 128.2 118.9 127.6 118.6 127.1 C 118.4 126.6 118 126.2 117.4 125.8 C 116.9 125.5 116.2 125.3 115.2 125.3 L 113.2 125.3 C 112.4 125.3 111.9 125.2 111.6 124.8 C 111.3 124.4 111.2 124 111.2 123.5 C 111.2 123.1 111.4 122.8 111.6 122.5 C 111.8 122.1 112.1 121.8 112.5 121.7 C 112.8 121.4 113.3 121.3 113.8 121.3 L 119.9 121.3 L 120.4 119.7 L 114.1 119.7 Z M 138.3 119.7 C 137 119.7 135.9 120.1 135.1 120.8 C 134.2 121.4 133.6 122.3 133.3 123.6 L 130.5 133.3 L 132.3 133.3 L 135.1 123.8 C 135.3 122.9 135.7 122.3 136.2 122 C 136.6 121.5 137.3 121.4 138.1 121.4 L 140.1 121.4 L 140.6 119.7 L 138.3 119.7 Z M 142.5 119.7 L 138.7 133.3 L 140.4 133.3 L 144.4 119.7 L 142.5 119.7 Z M 165.5 119.7 C 164.6 119.7 163.7 119.9 163 120.3 C 162.3 120.7 161.8 121.2 161.4 121.8 C 160.9 122.4 160.7 123 160.6 123.7 C 160.5 124.3 160.6 124.9 160.8 125.4 C 161.1 125.9 161.4 126.3 161.9 126.6 C 162.5 126.9 163.2 127.1 164.1 127.1 L 166.2 127.1 C 167 127.1 167.6 127.3 168 127.7 C 168.2 128.1 168.4 128.5 168.3 129.1 C 168.2 129.5 168.1 129.9 167.8 130.4 C 167.6 130.7 167.2 131 166.8 131.3 C 166.4 131.6 165.8 131.7 165.3 131.7 L 158.6 131.7 L 158.2 133.3 L 165 133.3 C 165.9 133.3 166.8 133.1 167.5 132.7 C 168.3 132.2 168.8 131.7 169.3 131 C 169.8 130.3 170 129.6 170.2 128.8 C 170.3 128.2 170.2 127.6 170 127.1 C 169.7 126.6 169.3 126.2 168.8 125.8 C 168.2 125.5 167.5 125.3 166.6 125.3 L 164.6 125.3 C 163.8 125.3 163.2 125.2 162.9 124.8 C 162.6 124.4 162.5 124 162.5 123.5 C 162.6 123.1 162.7 122.8 162.9 122.5 C 163.1 122.1 163.5 121.8 163.8 121.7 C 164.2 121.4 164.7 121.3 165.2 121.3 L 171.2 121.3 L 171.7 119.7 L 165.5 119.7 Z M 83 121 C 83.9 121 84.7 121.2 85.4 121.7 C 86.1 122.1 86.6 122.7 86.9 123.5 C 87.3 124.3 87.4 125.3 87.1 126.3 C 87 127.4 86.6 128.3 86 129.2 C 85.4 130.1 84.6 130.7 83.7 131.3 C 82.9 131.8 82 132 81 132 C 80 132 79.2 131.8 78.5 131.3 C 77.9 130.9 77.4 130.2 77.1 129.5 C 76.7 128.7 76.7 127.8 76.8 126.9 C 76.9 125.8 77.3 124.7 77.9 123.9 C 78.6 123 79.3 122.3 80.2 121.8 C 81 121.2 82 121 83 121 L 83 121 Z M 153.8 121 C 154.8 121 155.5 121.2 155.9 121.6 C 156.4 122 156.6 122.5 156.5 123.2 C 156.1 124.4 155 125.5 153.9 126 C 153.1 126.3 152.2 126.5 151.2 126.7 C 149.7 127 148.7 127.2 147.4 127.1 L 147.4 127 C 147.6 124.8 149.1 123 150.8 121.8 C 151.9 121.2 152.8 121 153.8 121 Z"/>
<path id="path88972" style="fill:#ffffff;stroke-width:0.993985;stroke-linecap:square;paint-order:fill markers stroke" d="M 93 -0.076 C 86.1 0.226 80.1 4.968 78.1 11.94 L 77.1 14.26 C 76.2 12.64 74.2 11.44 71.2 10.73 C 62.3 8.4 53.4 13.65 51.4 22.22 L 41.5 59.46 C 39.5 68.13 44.5 77.01 52.4 79.33 C 56.3 80.24 60.3 79.94 63.3 78.73 C 64.3 83.77 68.2 87.81 74.2 89.32 C 83.1 91.64 91 86.5 94 77.82 L 95 75.5 C 96 77.31 98.9 78.63 100.9 79.33 C 109.8 81.65 118.7 76.41 120.7 67.83 L 130.6 30.6 C 132.6 21.93 127.6 13.04 119.7 10.73 C 115.8 9.71 111.8 10.12 108.8 11.64 C 106.9 6.38 102.9 1.941 97.9 0.428 C 96 0.025 95 -0.177 93 -0.076 L 93 -0.076 Z M 94 9.61 C 94 9.61 95 9.71 95 9.81 C 98.9 10.83 100.9 14.36 99.9 17.99 L 85.1 75.5 C 84.1 79.03 80.1 81.05 76.2 79.94 C 74.2 79.23 71.2 75.7 72.2 72.07 L 88 14.56 C 89 11.44 91 9.51 94 9.61 L 94 9.61 Z M 66.2 19.81 C 67.2 19.81 68.2 19.91 68.2 20.11 C 71.2 20.92 73.2 24.35 72.2 27.98 L 62.3 65.21 C 61.3 68.84 58.3 70.76 55.4 69.95 C 51.4 68.94 49.4 65.41 50.4 61.78 L 60.3 24.55 C 61.3 21.73 63.3 19.81 66.2 19.81 L 66.2 19.81 Z M 115.8 19.91 C 115.8 19.91 116.8 20.01 116.8 20.11 C 120.7 21.12 122.7 24.65 121.7 28.28 L 111.8 65.51 C 110.8 69.04 107.8 71.06 103.9 69.95 C 100.9 69.14 98.9 65.72 99.9 62.08 L 109.8 24.85 C 110.8 21.73 112.8 19.81 115.8 19.91 L 115.8 19.91 Z"/>
</svg>
<div class='progress-bar' id="progressBar"></div>
<button type="button" disabled data-to="mainmenu">continue</button>
</div>
</section>
<section id='gamecamera'>
<div class="map" id="map">
<div class='layer track'>
<img data-layer="track" src='' alt='' />
</div>
<div class="layer players">
<div class="ruler"></div>
<div class='finish-portal'>
<div class='led-board'>
<div class='sponsors'></div>
</div>
</div>
<div class='sprites pylons'></div>
<div class='sprites marshals'></div>
<div class='sprites trees'></div>
</div>
<div class='layer lights'>
<img data-layer="lights" src='' alt='' />
<span class="car-lights player" id="lights-player">
<img src='assets/car/car-lights.png' alt='' class="car-lights headlights" />
<img src='assets/car/car-lights-2.png' alt='' class="car-lights interior" />
<img src='assets/car/car-brake-lights.png' alt='' class="car-lights brakes" />
</span>
</div>
<div class='layer elevated'>
<img data-layer="elevated-1" src='' alt='' />
<img data-layer="elevated-2" src='' alt='' />
</div>
<div class='layer weather' data-layer="weather"></div>
<div class='layer pointer'>
<div class="layer waypoints" id="waypointsOverlay" ></div>
<div class="waypointer">
<span class="material-icons">forward</span>
</div>
</div>
</div>
<div class='hud'>
<span class='session'>
<span class='status'>free practice</span>
<span class='time'>10:00</span>
<ul class='competitors'>
</ul>
</span>
<span class='racecontrol'>
<span class="notice"></span>
<span class="warning"></span>
</span>
<ul class='timing'>
<li class='bestlap'></li>
<li class='lastlap'></li>
<li class='thislap'></li>
</ul>
<span class='team'>
<span class='radio'></span>
<span class='status'></span>
</span>
<span class='car'>
<span class='fuel'></span>
</span>
</div>
</section>
<section id='mainmenu'>
<form action="#" name="gamesettings">
<fieldset class="columns driver">
<header><span class="material-icons">sports_motorsports</span> Driver</header>
<label for='displayname'>
<input type='text' name='displayname' id='displayname' placeholder="Enter your name" value="Player 1" required/>
<span>Name</span>
</label>
<label for='carnumber'>
<input type='number' name='carnumber' id='carnumber' placeholder="44" max="999" value="1" required />
<span>Preferred driver number</span>
</label>
<label for='carnumber-alt'>
<input type='number' name='carnumber-alt' id='carnumber-alt' placeholder="33" value="0" max="999" />
<span>Alternative driver number</span>
</label>
</fieldset>
<fieldset class="team car">
<header><span class='material-icons'>airport_shuttle</span> Car</header>
<label for='porsche'>
<input type='radio' name="team" value="porsche" id="porsche" checked/>
<span>
<strong>Porsche</strong>
<small>White</small>
</span>
<img src='assets/car/porsche-body.png' alt='' />
</label>
<label for='ferrari'>
<input type='radio' name="team" value="ferrari" id="ferrari" checked/>
<span>
<strong>Ferrari</strong>
<small>Red</small>
</span>
<img src='assets/car/ferrari-body.png' alt='' />
</label>
<label for='ford'>
<input type='radio' name="team" value="ford" id="ford" checked/>
<span>
<strong>Ford</strong>
<small>Black</small>
</span>
<img src='assets/car/ford-body.png' alt='' />
</label>
<label for='lamborghini'>
<input type='radio' name="team" value="lamborghini" id="lamborghini" checked/>
<span>
<strong>Lamborgini</strong>
<small>Yellow</small>
</span>
<img src='assets/car/lamborghini-body.png' alt='' />
</label>
</fieldset>
<fieldset class="track">
<header><span class="material-icons"> emoji_events</span> Event</header>
<label for='test'>
<input type='radio' name="track" value="test" id="test" checked/>
<span>
<strong>Test track</strong>
<small>Home</small>
</span>
<img src='assets/track/test.svg#track' alt='' />
</label>
<label for='imola'>
<input type='radio' name="track" value="imola" id="imola" checked/>
<span>
<strong>Imola</strong>
<small>Bolgona, ITA</small>
</span>
<img src='assets/track/imola.svg#track' alt='' />
</label>
<label for='austin'>
<input type='radio' name="track" value="austin" id="austin" checked/>
<span>
<strong>COTA</strong>
<small>Austin, TX</small>
</span>
<img src='assets/track/austin.svg#track' alt='' />
</label>
<label for='interlagos'>
<input type='radio' name="track" value="interlagos" id="interlagos"/>
<span>
<strong>Interlagos</strong>
<small>São Paolo, BR</small>
</span>
<img src='assets/track/interlagos.svg#track' alt=''/>
</label>
<label for='monaco'>
<input type='radio' name="track" value="monaco" id="monaco"/>
<span>
<strong>Monte Carlo</strong>
<small>Monaco, FR</small>
</span>
<img src='assets/track/monaco.svg#track' alt=''/>
</label>
<label for='assen'>
<input type='radio' name="track" value="assen" id="assen"/>
<span>
<strong>Assen</strong>
<small>Drenthe, NL</small>
</span>
<img src='assets/track/assen.svg#track' alt=''/>
</label>
<label for='zandvoort'>
<input type='radio' name="track" value="zandvoort" id="zandvoort" />
<span>
<strong>Zandvoort</strong>
<small>Noord-Holland, NL</small>
</span>
<img src='assets/track/zandvoort.svg#track' alt=''/>
</label>
<label for='losail'>
<input type='radio' name="track" value="losail" id="losail" />
<span>
<strong>Losail</strong>
<small>Doha, QT</small>
</span>
<img src='assets/track/losail.svg#track' alt=''/>
</label>
</fieldset>
<fieldset class="settings">
<header><span class="material-icons">engineering</span> Settings</header>
<label for='ambient-volume'>
<span>
<strong>Ambient</strong>
<small>volume</small>
</span>
<input type='range' name='ambient-volume' id='ambient-volume' min="0" max="1" step="0.1" value="0.5"/>
</label>
<label for='engine-volume'>
<span>
<strong>Engine</strong>
<small>volume</small>
</span>
<input type='range' name='engine-volume' id='engine-volume' min="0" max="1" step="0.1" value="0.5"/>
</label>
<label for='clouds'>
<span>
<strong>Clouds</strong>
<small>graphics</small>
</span>
<input type='checkbox' name="clouds" id="clouds"/>
<span class='material-icons'>cloud_queue</span>
</label>
<label for='wind'>
<span>
<strong>Wind</strong>
<small>graphics</small>
</span>
<input type='checkbox' name="wind" id="wind"/>
<span class='material-icons' >air</span>
</label>
<label for='camera-zoom'>
<span>
<strong>Dynamic zoom</strong>
<small>graphics</small>
</span>
<input type='checkbox' name="camera-zoom" id="camera-zoom"/>
<span class="material-icons">videocam</span>
</label>
</fieldset>
<fieldset>
<footer><button type="submit" data-to="gamecamera" name="startGame" value="true">Drive</button></footer>
</fieldset>
</form>
</section>
<section id="sessionmenu">
<fieldset class="laptimes">
<header><span class="material-icons">flag</span> Session results</header>
<table cellspacing="0">
<thead>
<tr>
<th></th>
<th>sector 1</th>
<th>sector 2</th>
<th>sector 3</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</fieldset>
<form id="carSettings">
<fieldset id='sessionSettings' class="settings">
<header><span class="material-icons">engineering</span> Car setup</header>
<label for="baseForce">
<span>base force</span>
<input type='range' id="baseForce" value=".55" min="0.4" max="0.6" step="0.01" />
<output for="baseForce"></output>
</label>
<label for="baseTurningSpeed">
<span>max steering angle</span>
<input type='range' id="baseTurningSpeed" value="1.5" min="2
" max="4" step="0.1"/>
<output for="baseTurningSpeed"></output>
</label>
</form>
<fieldset>
<footer>
<a class="button" href="/">main menu</a>
</footer>
</fieldset>
</section>
<iframe src="" id="iframe" style="height: 100vh; width: 100vw; position: absolute; inset:0; opacity: 0"></iframe>
<section class="offscreen" style="height: 0px; overflow: hidden">
<section class="sprites">
<span id="rubberTrackSprite" class="sprite rubber"><img src='assets/car/tire-rubber-128.png' alt='' /></span>
<span id="smokeSprite" class="sprite smoke"><img src='assets/smoke/smoke-sprite.png' alt='' class="smoke" loading="eager"/></span>
<span id="exhaustPopSprite" class="sprite exhaust"><img src='assets/car/exhaust-pop.png' alt='' class="pop"/></span>
<span id="explosionsSprite" class="sprite explosion"><img src='assets/boom3.png' alt='' id="" class="explosion"/></span>
<span id="ahornTreeSprite" class="sprite tree ahorn"></span>
<span id="palmTreeSprite" class="sprite tree palm"></span>
<img id="marshalSprite" class="sprite marshal" src="assets/people/oldman_walk_sheet_2.png" class="uv" width="512px" height="64px"/>
<img id="pylonSprite" class="sprite pylon" src="assets/environment/cone-1.png">
<span id="truckSprite" class="sprite truck"><img src="assets/environment/truck.png"></span>
</section>
<section class="audio">
<audio src="assets/sound/porsche-onboard-acc-full.ogg" class="engine" id="engineSound" loop volume="0.0"></audio>
<audio src="assets/sound/porsche-onboard-downshift.ogg" class="engine" id="downshiftSound" volume="0.0"></audio>
<audio src="assets/sound/porsche-ambient-loop.ogg" id="ambientSfx" loop volume="0.0"></audio>
<audio src="assets/sound/ui/rattle.wav" id="changeSfx"></audio>
</section>
<section class="cars">
<div class="car-body player" data-velocity="0">
<span class='interior'></span>
<span class='body'>
<span class="livery">
<span class="driver-id"></span>
<span class="wing"></span>
</span>
</span>
<audio src="./assets/sound/bicycle-horn-1.ogg" controls class="horn"></audio>
</div>
<div class="car-body npc"><img src='assets/car/ferrari.png' alt='ferrari' class="livery"/></div>
<div class="car-body npc"><img src='assets/car/lamborghini.png' alt='lamborghini'class="livery" /></div>
<div class="car-body npc"><img src='assets/car/porsche.png' alt='porsche' class="livery" /></div>
</section>
<section class="tracks">
<img src='assets/track/home.svg' alt=''/>
<img src='assets/track/austin.svg' alt=''/>
<img src='assets/track/assen.svg' alt=''/>
<img src='assets/track/interlagos.svg' alt=''/>
<img src='assets/track/zandvoort.svg' alt=''/>
</section>
<section class="svg-filters">
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="displacementFilter">
<feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="2" seed="3" result="turbulence">
<animate attributeName="seed" from="0" to="600" begin="0s" dur="10s" repeatCount="indefinite"></animate>
</feTurbulence>
<feDisplacementMap in2="turbulence" in="SourceGraphic" scale="10" xChannelSelector="R" yChannelSelector="G">
</feDisplacementMap>
</filter>
<filter id="specularLight"
style="color-interpolation-filters:sRGB;"
inkscape:label="Specular Light"
x="-0.050315805"
y="-0.050315805"
width="1.1006316"
height="1.1006316">
<feGaussianBlur
in="SourceAlpha"
stdDeviation="10"
result="blur"
id="feGaussianBlur67" />
<feSpecularLighting
in="blur"
specularExponent="35.0"
specularConstant="10"
surfaceScale="5"
lighting-color="#fce48d"
result="specular"
id="feSpecularLighting67">
<feDistantLight
azimuth="270"
elevation="156"
id="feDistantLight67" />
</feSpecularLighting>
<feComposite
in="specular"
in2="SourceGraphic"
k3="1"
k2="1"
operator="arithmetic"
result="composite1"
id="feComposite67" />
<feComposite
in="composite1"
in2="SourceAlpha"
operator="in"
result="composite2"
id="feComposite68" />
</filter>
</defs>
</svg>
</section>
</section>
<template>
<!-- todo: add car template -->
</template>
</body>
<!-- <script src="js/main.js" type="module" ></script> -->
<script type="module">
import Game from './js/main.js';
const savedata = JSON.parse(localStorage.getItem('savedata')) || {};
const settingsForm = document.forms.gamesettings;
console.info(settingsForm)
const worldMap = document.querySelector('#map')
for (const setting in savedata) {
if (settingsForm.elements[setting]) {
settingsForm.elements[setting].value = savedata[setting];
}
// console.log(setting, savedata[setting])
}
let progress = 0;
const preloadItems = [...document.querySelectorAll('.offscreen img[src]'),...document.querySelectorAll('.offscreen audio')];
const mainmenuButton = document.querySelector('[data-to="mainmenu"]');
const ambientSfxLevel = document.querySelector('input[name="ambient-volume"]');
const engineSfxLevel = document.querySelector('input[name="engine-volume"]');
function updateProgressBar(element, index) {
let total = preloadItems.length;
progress += Math.round((1 / total) * 100);
progressBar.style.setProperty('--progress', progress)
}
function uiBleep() {
changeSfx.volume = ambientSfxLevel.value / 4;
changeSfx.currentTime = 0;
changeSfx.play()
}
preloadItems.forEach( (element, index) => {
element.addEventListener('load', (e) => { updateProgressBar(element, index)});
});
ambientSfx.addEventListener('play', () => {
let fadeIn = setInterval(() => {
if(ambientSfx.volume < Number(ambientSfxLevel.value).toFixed(1)) {
ambientSfx.volume += 0.05;
} else {
clearInterval(fadeIn)
}
}, 25);
});
engineSound.addEventListener('play', () => {
let fadeIn = setInterval(() => {
if(engineSound.volume < Number(engineSfxLevel.value).toFixed(1)) {
engineSound.volume += 0.05;
} else {
clearInterval(fadeIn)
}
}, 25);
})
mainmenuButton.addEventListener('click', () => {
if(ambientSfx.paused) ambientSfx.play();
document.body.dataset.state = 'mainmenu';
})
ambientSfxLevel.addEventListener('input', (e) => {
ambientSfx.volume = e.target.value / 2;
if(e.target.value == 0) {
ambientSfx.pause();
} else if ( ambientSfx.paused ){
ambientSfx.play();
}
});
engineSfxLevel.addEventListener('input', (e) => {
engineSound.volume = e.target.value / 2;
if(e.target.value <= 0) {
engineSound.pause();
} else if ( engineSound.paused ){
engineSound.loop = false;
engineSound.play();
}
if(window.game.player.engineSound) {
window.game.player.engineSound.gain = e.target.value;
}
});
engineSfxLevel.addEventListener('change', (e) => {
engineSound.loop = false;
});
document.forms[0].addEventListener('submit', (e) => {
let formData = new FormData(e.target)
let newsavedata = {}
for (const [key, value] of formData) {
newsavedata[key] = value;
}
localStorage.setItem('savedata', JSON.stringify(newsavedata));
});
function startGame () {
document.querySelector('.progress-bar').classList.remove('loaded');
progressBar.style.setProperty('--progress', 10);
console.log('start game');
// TODO: add settings option for fullscreen
// document.body.requestFullscreen();
document.body.dataset.state = 'splash';
document.body.classList.add('loading');
mainmenuButton.style.display = 'none';
if(savedata['waypoints']) worldMap.classList.add('waypoints')
if(savedata['clouds']) worldMap.classList.add('clouds')
if(savedata['wind']) worldMap.classList.add('wind')
if(savedata['camera-zoom']) worldMap.classList.add('camera-zoom')
window.initGame(savedata);
}
document.forms[0].addEventListener('change', (e) => {
if(e.target.type == 'checkbox') {
if(e.target.checked) {
worldMap.classList.add(e.target.name)
} else {
worldMap.classList.remove(e.target.name)
}
}
})
window.initGame = (savedata) => {
delete window.game;
// play the ambient loop until the end and then not repeat after that
window.ambientSfx.loop = false;
window.game = new Game();
console.log('✅ new Game');
console.info(window.game);
progressBar.style.setProperty('--progress', 35);
window.game.init(savedata['track'], {...savedata});
console.log('✅ game.init');
ambientSfx.volume = savedata['ambient-volume'];
engineSound.volume = savedata['engine-volume'];
ambientSfx.play();
console.log('🔊 ambientSfx');
window.animationRequest = undefined;
let lastTime = 0;
const animate = (timeStamp) => {
const deltaTime = timeStamp - lastTime;
lastTime = timeStamp;
window.game.render(deltaTime, timeStamp);
window.animationRequest = requestAnimationFrame(animate);
}
setTimeout(() => {
animate(0);
}, 500)
}
window.addEventListener('change', (e) => {
uiBleep();
});
Array.from(document.querySelectorAll('button')).forEach(element => {
element.addEventListener('click', () => {
uiBleep();
})
});
let loc = new URL(document.location);
if(loc.searchParams.get('startGame') == 'true') {
startGame();
} else {
window.addEventListener('load', () => {
progressBar.style.setProperty('--progress', 100)
progressBar.classList.add('loaded');
mainmenuButton.removeAttribute('disabled');
setTimeout(()=> {
mainmenuButton.click();
}, 500);
ambientSfx.volume = 0.0;
ambientSfx.play()
});
}
</script>
</html>