Skip to content

Commit 2d533d2

Browse files
feat(gamepad-tester): add gamepad visuals
1 parent e763173 commit 2d533d2

3 files changed

Lines changed: 418 additions & 4 deletions

File tree

_sass/styles.scss

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,128 @@ table tr:nth-child(2n) {
239239
color: var(--text-col);
240240
}
241241

242+
/* Controller visualization */
243+
.gamepad-visual {
244+
align-items: center;
245+
display: grid;
246+
gap: 1rem;
247+
grid-template-columns: minmax(4.5rem, 6rem) minmax(0, 64rem) minmax(4.5rem, 6rem);
248+
justify-content: center;
249+
min-height: 16rem;
250+
}
251+
252+
.gamepad-visual > .text-muted {
253+
grid-column: 1 / -1;
254+
}
255+
256+
.gamepad-visual-svg {
257+
display: block;
258+
height: auto;
259+
max-height: 28rem;
260+
max-width: 64rem;
261+
overflow: visible;
262+
width: 100%;
263+
}
264+
265+
.gamepad-visual-control {
266+
fill: var(--bs-primary);
267+
fill-opacity: 0;
268+
pointer-events: none;
269+
transition: fill-opacity 50ms linear;
270+
}
271+
272+
.gamepad-visual-control.active {
273+
filter: drop-shadow(0 0 1.25rem var(--bs-primary));
274+
}
275+
276+
.gamepad-trigger-visual {
277+
--gamepad-trigger-value: 0%;
278+
align-items: center;
279+
align-self: start;
280+
background-color: var(--footer-col);
281+
border: 2px solid var(--navbar-border-col);
282+
border-radius: 0.75rem;
283+
display: flex;
284+
flex-direction: column;
285+
isolation: isolate;
286+
margin-top: 2.5rem;
287+
min-width: 0;
288+
overflow: hidden;
289+
padding: 0.5rem;
290+
position: relative;
291+
transition: border-color 50ms linear, box-shadow 50ms linear;
292+
}
293+
294+
.gamepad-trigger-visual.active {
295+
border-color: var(--bs-primary);
296+
box-shadow: 0 0 1rem rgba(var(--bs-primary-rgb), 0.55);
297+
}
298+
299+
.gamepad-trigger-fill {
300+
background-color: rgba(var(--bs-primary-rgb), 0.45);
301+
bottom: 0;
302+
height: var(--gamepad-trigger-value);
303+
left: 0;
304+
position: absolute;
305+
transition: height 50ms linear;
306+
width: 100%;
307+
z-index: -1;
308+
}
309+
310+
.gamepad-trigger-image {
311+
display: block;
312+
height: auto;
313+
max-height: 3rem;
314+
max-width: 100%;
315+
width: 4rem;
316+
}
317+
318+
.gamepad-trigger-name {
319+
display: none;
320+
font-weight: 700;
321+
line-height: 3rem;
322+
}
323+
324+
.gamepad-trigger-name.visible {
325+
display: block;
326+
}
327+
328+
.gamepad-trigger-value {
329+
font-size: 0.75rem;
330+
font-variant-numeric: tabular-nums;
331+
line-height: 1;
332+
margin-top: 0.35rem;
333+
}
334+
335+
.gamepad-stick-indicator {
336+
fill: var(--bs-primary);
337+
pointer-events: none;
338+
stroke: var(--page-col);
339+
stroke-width: 10;
340+
transition: transform 50ms linear;
341+
}
342+
343+
@media (max-width: 575.98px) {
344+
.gamepad-visual {
345+
gap: 0.35rem;
346+
grid-template-columns: 3rem minmax(0, 1fr) 3rem;
347+
min-height: 10rem;
348+
}
349+
350+
.gamepad-trigger-visual {
351+
margin-top: 1rem;
352+
padding: 0.25rem;
353+
}
354+
355+
.gamepad-trigger-image {
356+
max-height: 2rem;
357+
}
358+
359+
.gamepad-trigger-value {
360+
font-size: 0.65rem;
361+
}
362+
}
363+
242364
/* Stick visualization */
243365
.stick-circle {
244366
width: 120px;

0 commit comments

Comments
 (0)