-
Notifications
You must be signed in to change notification settings - Fork 1
/
homeworlds.css
687 lines (631 loc) · 15 KB
/
homeworlds.css
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
/**
*------
* BGA framework: © Gregory Isabelli <[email protected]> & Emmanuel Colin <[email protected]>
* Homeworlds implementation : © Jonathan Baker <[email protected]>
*
* This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
* See http://en.boardgamearena.com/#!doc/Studio for more information.
* -----
*
* homeworlds.css
*
* Homeworlds stylesheet
*
*/
#HWboard{
/* Board margin-right makes space for bank and legend */
margin-right:220px;
/* height:1000px; */
/*background:rgba(255,255,255,0.3);*/
display:block;
}
html.hw_bg_stars #overall-content{
/*background-image:url('https://i.imgur.com/hoVyIVr.png');*/
/*background-image:url('https://i.imgur.com/S4h3S6K.png');*/
background-image:url('https://i.imgur.com/DC2XVh0.png');
}
#HWbank{
/*
Bank must not have default position type (static)
or its width/height can't be used for relative sizes of stacks
*/
position:relative;
width:200px;
height:600px;
float:right;
background:rgba(255,255,255,0.1);
}
/* A stack is a place for identical pieces in the bank */
.HWstack{
display:inline-block;
position:absolute;
width:33.3%;
height:25%;
}
/*
Make pieces in the stack higher the more children there are
It's better to count from the end than from the beginning because,
while adding tutorial annotation images,
mousing over an element causes it to have a new child
at the beginning of its list.
If you determine height by counting from the start of the list,
the pieces hop around as you mouse over the bank.
*/
.HWstack>*{
position:absolute;
}
.HWstack>*:nth-last-child(1){
bottom:0px;
z-index:1;
}
.HWstack>*:nth-last-child(2){
bottom:20px;
z-index:2;
}
.HWstack>*:nth-last-child(3){
bottom:40px;
z-index:3;
}
/*
Pieces traveling to the board should be in front of stacked pieces
in order to not look weird.
*/
.HWship,.HWstar{
z-index:4;
}
/********
Systems
********/
.HWsystem{
border:2px solid white;
display:inline-block;
margin:5px;
padding:8px;
border-radius:20px;
position:relative;
}
/* A homeworld system with a non-none homeplayer_id attribute*/
.HWsystem:not([homeplayer_id=none]){
border:5px double white;
}
/*
A dummy div so that the system container can be centered
and rows of same-sized systems are created
*/
.HWcenterizer{
text-align:center;
display:block;
min-height:50px;
}
/* A centered, collection-fitting container for same-sized systems */
.HWsystem_container{
display:inline-block;
vertical-align:top;
}
/* All pieces use the same sprite background */
.HWship,.HWstar,.HWbanked {
background-image:url('img/sprites.svg');
background-repeat:no-repeat;
background-size:128px 600px;
display:inline-block;
/* full size: 256px 1200; */
}
.HWship,.HWstar,#HWturn_token{
position:relative;
transition:.5s;
}
.HWstar_container{
display:inline-block;
text-align:center;
}
.HWsystem_label{
margin:0px 5px 0px 5px;
color:white;
}
/* Symbol indicator appears on pieces for colorblind friendliness */
.HWcolor_symbol{
position:absolute;
height:20px;
width:20px;
margin:auto;
background-image:url('img/colorblind-white.svg');
background-repeat:no-repeat;
background-size:20px 80px;
}
.HWpiece>.HWcolor_symbol{
left:0;
right:0;
}
.HWsymbol_red{
background-position-y:-0px;
}
.HWsymbol_yellow{
background-position-y:-20px;
}
.HWsymbol_green{
background-position-y:-40px;
}
.HWsymbol_blue{
background-position-y:-60px;
}
/* To get the symbol in a vertically good spot,
they need a margin according to the piece size */
.HWlarge.HWbanked>.HWcolor_symbol,.HWlarge.HWship>.HWcolor_symbol{
margin-top:40px;
}
.HWmedium.HWbanked>.HWcolor_symbol,.HWmedium.HWship>.HWcolor_symbol{
margin-top:32px;
}
.HWsmall.HWbanked>.HWcolor_symbol,.HWsmall.HWship>.HWcolor_symbol{
margin-top:15px;
}
.HWlarge.HWstar>.HWcolor_symbol{
margin-top:15px;
}
.HWmedium.HWstar>.HWcolor_symbol{
margin-top:10px;
}
.HWsmall.HWstar>.HWcolor_symbol{
margin-top:5px;
}
/* Hide the symbol on covered children */
.HWbanked:not(:first-child)>.HWcolor_symbol{
display:none;
}
/* Hide the symbol when colorblind mode is off */
html.colorblind_off .HWcolor_symbol{
display:none;
}
/* Hide the buttons when they are turned off*/
html.power_buttons_off #HWpowerBox{
display:none;
}
/* Hide the legend when it is turned off*/
html.legend_off .HWlegend_label{
display:none;
}
/* Legend labels */
.HWlegend_label{
transform:rotate(-90deg);
transform-origin:center left;
position:absolute;
color:white;
}
/* Rotate the symbol back so that it matches the ones on the pieces */
.HWlegend_label>.HWcolor_symbol{
display:inline;
margin-left:5px;
transform:rotate(90deg);
}
/*
Buttons
Power buttons are for selecting the power of a free action
Action buttons are actions of their own:
offering a draw
triggering a catastrophe
passing
canceling
*/
#HWpowerBox{
display:table;
border-spacing:5px;
margin-left:auto;
margin-right:auto;
border:1px solid black;
border-radius:7px;
margin-top:7px
}
#HWpowerBox.HWdisabled{
display:none;
}
.HWbutton{
border-radius:7px;
padding:0px 5px;
border-color:black;
border-style:solid;
border-width:1px;
cursor:pointer;
vertical-align:middle;
box-shadow:1px 1px 0px black;
line-height:normal;
font-size:14px;
padding:6px 12px;
position:relative; /* Need relative pos so annotations appear correctly */
}
.HWactionButton{
display:inline-block;
margin:0px 0px 2px 10px;
}
.HWpowerButton{
display:table-cell;
width:25%;
}
/*
Passing, catastrophes, and accepting draws are more severe actions
and the buttons will have a more alarming color
*/
.HWactionButton.HWhilit{
background-color:rgba(255,165,0,0.6);
}
.HWactionButton{
background-color:rgba(128,0,128,0.6);
}
.HWactionButton.HWdisabled{
display:none;
}
.HWpowerButton.HWdisabled{
background-color:rgba(128,128,128,0.6);
color:gray;
}
#HWpowerButton1:not(.HWdisabled){
background-color:rgba(255,0,0,0.6);
}
#HWpowerButton2:not(.HWdisabled){
background-color:rgba(255,255,0,0.6);
}
#HWpowerButton3:not(.HWdisabled){
background-color:rgba(0,255,0,0.6);
}
#HWpowerButton4:not(.HWdisabled){
background-color:rgba(0,64,255,0.6);
}
/*
The background image has every piece sprite.
This section sets the vertical background offset by piece color and orientation.
*/
/* Offset for the top of the color section in the sprite image */
.HWred{
--offsetC:-6px
}
.HWyellow{
--offsetC:-156px;
}
.HWgreen{
--offsetC:-305.5px
}
.HWblue{
--offsetC:-455px
}
/* Additional offsetP for the top of the piece */
.HWlarge.HWship,.HWlarge.HWbanked{
--offsetP:-0px;
margin-top:5px;
height:86px
}
.HWmedium.HWship,.HWmedium.HWbanked{
--offsetP:-9px;
margin-top:14px;
height:68px
}
.HWsmall.HWship,.HWsmall.HWbanked{
--offsetP:-18px;
margin-top:23px;
height:50px
}
.HWlarge.HWstar{
--offsetP:-93px;
margin-top:5px;
height:49px
}
.HWmedium.HWstar{
--offsetP:-98px;
margin-top:10px;
height:39px
}
.HWsmall.HWstar{
--offsetP:-103.5px;
margin-top:15.5px;
height:29px
}
/* Add the offsets together */
.HWship,.HWstar,.HWbanked{
background-position-y:calc(var(--offsetC) + var(--offsetP))
}
/* Non-banked pieces get bottom margin matching top margin for symmetry */
.HWlarge.HWship{
margin-bottom:5px;
}
.HWmedium.HWship{
margin-bottom:14px;
}
.HWsmall.HWship{
margin-bottom:23px;
}
.HWlarge.HWstar{
margin-bottom:5px;
}
.HWmedium.HWstar{
margin-bottom:10px;
}
.HWsmall.HWstar{
margin-bottom:15.5px;
}
/* Horizontal offset by and width depend on piece size. */
.HWlarge{
background-position-x:-1.5px;
width:49px;
}
.HWmedium{
background-position-x:-54.5px;
width:39px;
}
.HWsmall{
background-position-x:-98px;
width:29px;
}
.HWship{
transform:rotate(var(--rotateAmount));
}
.HWstar,#HWturn_token{
--rotateAmount:0deg;
}
/*
Give ships and stars a little horizontal margin
Use margin to center banked pieces
*/
.HWship,.HWstar{
margin-left:5px;
margin-right:5px;
}
.HWbanked{
margin:auto;
left:0;
right:0
}
/*
Ships and systems can be friendly or hostile.
These terms will need to be generalized if 3+ player is implemented.
*/
.HWhostile{
float:left;
}
.HWhostile.HWship{
--rotateAmount:180deg;
}
.HWfriendly{
float:right;
}
.HWfriendly.HWship{
--rotateAmount:0deg;
}
/***************
Selectable stuff
***************/
.HWselectable{
cursor:pointer;
}
/* Selectable stacks and systems get a white background that brightens on hover */
.HWselectable.HWstack,.HWselectable.HWsystem{
background-color:rgba(255,255,255,0.3);
}
.HWselectable.HWstack:hover,.HWselectable.HWsystem:hover{
background-color:rgba(255,255,255,0.6);
}
/*
Pieces get a shadow if they are selectable or activated.
On hover, the shadow tightens and looks stronger
*/
.HWselectable.HWpiece:hover,[activate]:not([activate=pending]){
filter:drop-shadow(0px 0px 10px var(--shadow_col));
}
.HWselectable.HWpiece{
--shadow_col:white;
}
/* TODO consider outlines instead of shadows and bobbing
This looks pretty good, though transparency would be good
outline: 5px solid green;
border-radius: 1px
Outlines don't interfere with element sizing the way borders do
border-radius also applies to outlines
*/
[activate='1']{
--shadow_col:#ff0000;
}
[activate='2']{
--shadow_col:#fff900;
}
[activate='3']{
--shadow_col:#00ff00;
}
[activate='4']{
--shadow_col:#0044ff;
}
[activate=sacrifice]{
--shadow_col:transparent;
}
/* Activated ship always bobs */
[activate]{
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-name:bob;
}
@keyframes bob {
50% {
transform: translate(0px,-5px);
}
100% {
transform: translate(0,0);
}
}
@keyframes shimmer {
50% {
filter: drop-shadow(0px 0px 25px var(--shadow_col));
}
100% {
filter: drop-shadow(0px 0px 10px var(--shadow_col));
}
}
/* Token's shadow embiggens on hover */
#HWturn_token.HWselectable:hover{
filter: drop-shadow(0px 0px 15px white);
}
/* Token throbs when the turn appears over */
#HWturn_token.HWonly_option{
/*filter:drop-shadow(15px -15px 10px white);*/
/* With black background, white shadow is needed for visibility,
so use animation to indicate the turn is over */
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-name: swell;
}
@keyframes swell {
50% {
transform: scale(.95, .95);
}
100% {
transform: scale(1, 1);
}
}
/*
Borrowed from
https://www.kirupa.com/snippets/getting_jittery_on_hover_using_only_css.htm
*/
.HWoverpopulated {
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-name: jittery;
}
@keyframes jittery {
10% {
transform: rotate(var(--rotateAmount)) translate(-2px, -3px) scale(1.01, 1.01);
}
20% {
transform: rotate(var(--rotateAmount)) translate(3px, 2px) scale(.99, .99);
}
30% {
transform: rotate(var(--rotateAmount)) translate(-4px, -5px) scale(1.01, 1.01);
}
40% {
transform: rotate(var(--rotateAmount)) translate(2px, 3px) scale(1, 1);
}
50% {
transform: rotate(var(--rotateAmount)) translate(-1px, -2px) scale(.98, .98);
}
60% {
transform: rotate(var(--rotateAmount)) translate(0px, 3px) scale(1.02, 1.02);
}
70% {
transform: rotate(var(--rotateAmount)) translate(-2px, -4px) scale(1, 1);
}
80% {
transform: rotate(var(--rotateAmount)) translate(3px, 5px) scale(.99, .99);
}
90% {
transform: rotate(var(--rotateAmount)) translate(-5px, -3px) scale(1.1, 1.1);
}
100% {
transform: rotate(var(--rotateAmount)) translate(3px, 1px) scale(.95, .95);
}
}
/********************************
Modifications to main BGA display
********************************/
/* Hide the dash that would be the player score in other games */
.player_score_value{
display:none
}
/*
Hide the star that would be by the player score in other games
WARNING: The BGA rating form also uses .fa-star,
so make sure the selector is more specific
*/
.player_score>.fa-star{
display:none
}
/* Hide the dot that would separate the game score from the elo */
.player_elo_wrap{
font-size:0px;
}
/* DON'T hide the children of the player_elo_wrap, like the elo score itself */
.player_elo_wrap>*{
font-size:16px;
}
#HWfirst_player_indicator{
font-size:75%;
margin-top:10px;
}
/* Turn token */
.HWtoken_space{
position:relative;/*Relative or absolute position needed for sliding*/
/* Token moves up 5px on hover, systems are normally 96px high because large ships are 86 px and have 5px above and below*/
height:96px;
width:96px;
margin-top:5px;
display:inline-block;
float:left;
}
#HWturn_token{
position:relative;/*Relative or absolute position needed for sliding*/
background-image:url('img/turn_token.svg');
background-repeat:no-repeat;
background-size:100%;
height:100%;
width:100%;
/*
Without a z-index it sometimes appears to slide under pieces,
and pieces need z-index 4 to stay in front of stacked pieces
*/
z-index:5;
}
#HWturn_token:not(html.dj_safari .HWsliding,html.ios-user .HWsliding){
/*
Except while sliding in Safari,
add a subtle white outline to improve edge visibility
*/
filter:drop-shadow(0px 0px 5px white);
}
/* Animation marker shouldn't appear */
.HWanimarker{
/*
display:none;
This seems to make pieces invisible when markers are used for animations
*/
position:relative;
height:0px;
width:0px;
/* A size and background make it easier to find when debugging */
/*height:50px;*/
/*width:50px;*/
/*background-color:rebeccapurple;*/
/**/
}
/*
The centering margins of banked pieces mess up animations otherwise
This should probably be the same as for stars and ships to avoid jumpiness,
but I don't want to include it in the same command since this is the
animation section.
*/
.HWsliding:not(#HWturn_token){
margin-left:5px;
margin-right:5px;
}
/*
Try to make tutorial annotations right-side up on hostile ships.
The bobbing animation used by annotations messes up my correction,
so turn it off (not too noticeable)
*/
.HWhostile.HWship>.archiveCommentPointed{
transform: rotate(180deg);
left:0;
animation:none;
-webkit-animation:none;
}
.HWhostile.HWship.HWsmall>.archiveCommentPointed{
top:-35px;
}
.HWhostile.HWship.HWmedium>.archiveCommentPointed{
top:-25px;
}
.HWhostile.HWship.HWlarge>.archiveCommentPointed{
top:-15px;
}
/* Annotations should all be above pieces */
.archiveCommentPointed{
z-index:6;
}