index.html 1.78 KB
Newer Older
mara's avatar
mara committed
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
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>loading…</title>
    <style>
      body {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: #000000;
      }
      button {
        display: inline-block;
        border: none;
        padding: 0.5rem 1rem;
        margin: 0;
        text-decoration: none;
        background: #303030;
        color: #aaaaaa;
        font-family: sans-serif;
        font-size: 1rem;
        cursor: pointer;
        text-align: center;
        transition: background 250ms ease-in-out, 
                    transform 150ms ease;
        -webkit-appearance: none;
        -moz-appearance: none;
        text-shadow: #FFFFFF 0 0 12px;
      }

      button:hover {
        background: #2c0069;
      }
    </style>
  </head>
  <body>
    <div>
      <button id="play-pause" title="(Un)pause simulation"></button>
      <button id="randomize" title="Randomize universe"></button>
      <button id="omnicide" title="Kill universe"></button>
    </div>
    <canvas id="game-of-life-canvas" title="Universe-visualization
(click cell to toggle)"></canvas>
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    <script src="./wasm_game_of_life.js"></script>

    <script>
        const { main } = wasm_bindgen;

        var eventloop;

        function run() {
            eventloop = main(
                document.getElementById("game-of-life-canvas"),
                document.getElementById("play-pause"),
                document.getElementById("randomize"),
                document.getElementById("omnicide"));
        }

        wasm_bindgen('./wasm_game_of_life_bg.wasm').then(run);
    </script>
mara's avatar
mara committed
68
69
  </body>
</html>