-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.scss
127 lines (110 loc) · 2.75 KB
/
style.scss
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
html, body {
height: 100%;
box-sizing: border-box;
}
body {
display: flex;
width: 100%;
height: 100%;
margin: 0;
justify-content: center;
align-items: center;
font-family: sans-serif;
font-size: 16px;
}
*, *:before, *:after {
box-sizing: inherit;
}
.game {
user-select: none;
}
.notification-area {
padding: 1em;
line-height: 1;
text-align: center;
}
$grid-opponent-gradient:
$gridOpponentLineColor,
$gridOpponentLineColor $gridLineSize,
transparent $gridLineSize,
transparent calc($gridSpacing - $gridLineSize),
$gridOpponentLineColor calc($gridSpacing - $gridLineSize),
$gridOpponentLineColor $gridSpacing;
$grid-player-gradient:
$gridPlayerLineColor,
$gridPlayerLineColor $gridLineSize,
transparent $gridLineSize,
transparent calc($gridSpacing - $gridLineSize),
$gridPlayerLineColor calc($gridSpacing - $gridLineSize),
$gridPlayerLineColor $gridSpacing;
/* grid */
.grid {
$gridDimensions: calc($gridSpacing * 10 + $gridLineSize * 2);
position: relative;
width: $gridDimensions;
height: $gridDimensions;
border-width: $gridLineSize;
border-style: solid;
&--opponent {
border-color: $gridOpponentLineColor;
background-image:
repeating-linear-gradient($grid-opponent-gradient),
repeating-linear-gradient(90deg, $grid-opponent-gradient);
}
&--player {
border-color: $gridPlayerLineColor;
background-image:
repeating-linear-gradient($grid-player-gradient),
repeating-linear-gradient(90deg, $grid-player-gradient);
}
}
/* crosshair */
.grid__crosshair {
width: $gridSpacing;
height: $gridSpacing;
position: absolute;
border: 2px solid #000;
border-radius: calc($gridSpacing / 4);
&--hide {
display: none;
}
}
/* ships */
.grid__ship, .grid__shot, .grid__crosshair {
pointer-events: none;
}
.grid__ship {
transition-property: opacity, background, border-color;
transition-duration: 0.2s;
transition-timing-function: linear;
position: absolute;
border: 1px solid #000;
border-radius: calc($gridSpacing / 2);
background: rgba(0,0,0,0.5);
&--hide {
opacity: 0;
}
}
.grid__ship--highlight {
background: rgba(255,0,0,0.5);
border-color: #f00;
}
/* shots */
.grid__shot {
transition-property: opacity, transform;
transition-duration: 0.1s;
transition-timing-function: ease-in-out;
position: absolute;
margin: calc($gridSpacing / 4);
width: calc($gridSpacing / 2);
height: calc($gridSpacing / 2);
background: #000;
border-radius: 50%;
&--hide {
opacity: 0;
transform: scale(0.75);
}
}
.grid__shot--hit {
background: #f00;
}