File size: 1,007 Bytes
99ecf5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D Model Viewer</title>
    <script type="module" src="/script-3d.js"></script>
    <style>

        body, html {

            margin: 0;

            padding: 0;

            width: 100%;

            height: 100%;

            background-color: black;

            overflow: hidden;

            cursor: none;

        }

        model-viewer {

            width: 100%;

            height: 100%;

        }

    </style>
</head>
<body>
    <model-viewer src="3D-models/forest.glb" alt="A 3D model" auto-rotate camera-controls></model-viewer>
</body>
<script>

    document.addEventListener('keydown', (event) => {

      if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {

          event.preventDefault();

          window.parent.postMessage({ key: event.key }, '*');

      }

    });

</script> 
</html>