UNPKG

coherent-gameface-interaction-manager

Version:
70 lines (63 loc) 2.35 kB
<!--Copyright (c) Coherent Labs AD. All rights reserved. Licensed under the MIT License. See License.txt in the project root for license information. --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Spatial Navigation Demo</title> <style> body { background-color: white; display: flex; align-items: center; justify-content: center; flex-direction: column; } .container { width: 400px; display: flex; flex-wrap: wrap; } .square { width: 100px; height: 100px; background-color: cadetblue; border: 1px solid black; box-sizing: border-box; } .square:focus { background-color: crimson; } </style> </head> <body> <h2>Move the focus around by using the keyboard arrow keys or the gamepad d-pad</h2> <div class="container"> <div class="square">1</div> <div class="square">2</div> <div class="square">3</div> <div class="square">4</div> <div class="square">5</div> <div class="square">6</div> <div class="square">7</div> <div class="square">8</div> <div class="square">9</div> <div class="square">10</div> <div class="square">11</div> <div class="square">12</div> <div class="square">13</div> <div class="square">14</div> <div class="square">15</div> <div class="square">16</div> </div> <script src="../../dist/spatial-navigation.js"></script> <script src="../../dist/gamepad.js"></script> <script> spatialNavigation.init(['.square']); spatialNavigation.focusFirst(); gamepad.enabled = true; gamepad.lessSensitive = true; </script> </body> </html>