|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html lang="en">
|
| 3 | + |
3 | 4 | <head>
|
4 | 5 | <meta charset="UTF-8">
|
5 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 | 7 | <title>WebAssembly Test</title>
|
7 | 8 | <style>
|
8 | 9 | body {
|
9 |
| - margin: 0; |
| 10 | + margin: auto; |
| 11 | + padding-top: 1rem; |
10 | 12 | width: 100%;
|
11 | 13 | min-height: 100dvh;
|
12 |
| - background-color: black; |
| 14 | + background-color: #121212; |
| 15 | + color: #ffffff; |
| 16 | + font-family: 'Arial', sans-serif; |
| 17 | + max-width: 65rem; |
| 18 | + overflow: hidden; |
| 19 | + } |
| 20 | + |
| 21 | + header { |
| 22 | + text-align: center; |
| 23 | + margin-bottom: 40px; |
| 24 | + } |
| 25 | + |
| 26 | + h1 { |
| 27 | + margin: 0; |
| 28 | + font-size: 2.5em; |
| 29 | + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); |
| 30 | + } |
| 31 | + |
| 32 | + a { |
| 33 | + color: #1e90ff; |
| 34 | + text-decoration: none; |
| 35 | + font-size: 1.1em; |
| 36 | + transition: color 0.3s ease; |
| 37 | + } |
| 38 | + |
| 39 | + a:hover { |
| 40 | + color: #00bfff; |
| 41 | + } |
| 42 | + |
| 43 | + .canvas-container { |
| 44 | + display: flex; |
| 45 | + flex-direction: column; |
| 46 | + justify-content: center; |
| 47 | + align-items: center; |
| 48 | + position: relative; |
| 49 | + } |
| 50 | + |
| 51 | + canvas { |
| 52 | + border-radius: 15px; |
| 53 | + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7); |
| 54 | + border: 2px solid #1e90ff; |
| 55 | + } |
| 56 | + |
| 57 | + .loading { |
| 58 | + position: absolute; |
| 59 | + top: 50%; |
| 60 | + left: 50%; |
| 61 | + transform: translate(-50%, -50%); |
| 62 | + font-size: 1.5em; |
| 63 | + color: #1e90ff; |
| 64 | + font-weight: bold; |
| 65 | + display: none; |
| 66 | + } |
| 67 | + |
| 68 | + .description { |
| 69 | + padding: 1rem; |
| 70 | + margin-bottom: 1rem; |
| 71 | + background: rgba(255, 255, 255, 0.1); |
| 72 | + border-radius: 10px; |
| 73 | + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); |
| 74 | + text-align: justify; |
| 75 | + } |
| 76 | + |
| 77 | + .description p { |
| 78 | + line-height: 1.6; |
| 79 | + margin: 1em 0; |
| 80 | + } |
| 81 | + |
| 82 | + .instructions { |
| 83 | + text-align: center; |
| 84 | + margin: 20px; |
| 85 | + } |
| 86 | + |
| 87 | + .instructions p { |
| 88 | + font-size: 1.2em; |
| 89 | + } |
| 90 | + |
| 91 | + kbd { |
| 92 | + background-color: #333; |
| 93 | + border-radius: 3px; |
| 94 | + border: 1px solid #666; |
| 95 | + box-shadow: 0 1px 0 #666, 0 1px 0 1px rgba(255, 255, 255, 0.1); |
| 96 | + color: #fff; |
| 97 | + display: inline-block; |
| 98 | + font-size: 1em; |
| 99 | + line-height: 1.4; |
| 100 | + padding: 2px 6px; |
| 101 | + margin: 0 2px; |
| 102 | + white-space: nowrap; |
13 | 103 | }
|
14 | 104 | </style>
|
15 | 105 | </head>
|
| 106 | + |
16 | 107 | <body>
|
| 108 | + <header> |
| 109 | + <h1>WebAssembly Test</h1> |
| 110 | + <a href="https://github.com/codam-coding-college/MLX42" target="_blank">Visit MLX42 GitHub Repo</a> |
| 111 | + </header> |
| 112 | + <section class="description"> |
| 113 | + <p> |
| 114 | + This little demo demonstrates how you compile MLX42 using emscripten to leverage the power of WebAssembly |
| 115 | + and run any graphical project directly in the web! |
| 116 | + </p> |
| 117 | + </section> |
| 118 | + <div class="canvas-container"> |
| 119 | + <span class="loading">Loading...</span> |
| 120 | + <canvas width="1024" height="1024" id="canvas"></canvas> |
| 121 | + </div> |
| 122 | + <div class="instructions"> |
| 123 | + <p>Use <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> <kbd>→</kbd> to move the element in the canvas.</p> |
| 124 | + </div> |
17 | 125 | <script src="coi-serviceworker.js"></script>
|
18 |
| - <span class="load">Loading...</span> |
19 |
| - <canvas width="1024" height="1024" id="canvas"></canvas> |
20 | 126 | <script>
|
21 | 127 | var Module = {
|
22 | 128 | // This is called when the Emscripten module is ready
|
23 | 129 | onRuntimeInitialized: () => {
|
24 | 130 | console.log("Emscripten module initialized");
|
25 |
| - var loadingText = document.querySelector('.load'); |
| 131 | + var loadingText = document.querySelector('.loading'); |
26 | 132 | loadingText.style.display = 'none';
|
27 | 133 | },
|
28 | 134 | canvas: (() => {
|
29 | 135 | var canvas = document.getElementById('canvas');
|
30 |
| - canvas.addEventListener("webglcontextlost", function(e) { |
| 136 | + canvas.addEventListener("webglcontextlost", function (e) { |
31 | 137 | alert('WebGL context lost. Reload the page.');
|
32 | 138 | e.preventDefault();
|
33 | 139 | }, false);
|
|
37 | 143 | </script>
|
38 | 144 | <script src="demo.js"></script>
|
39 | 145 | </body>
|
| 146 | + |
40 | 147 | </html>
|
0 commit comments