|
| 1 | +import Block from "./Block"; |
| 2 | +import Line from "./Line"; |
| 3 | +import code_anim from "./anim_code"; |
| 4 | +import "./anim_glitch"; |
| 5 | + |
| 6 | +export default |
| 7 | +function HUD() { |
| 8 | + return html` |
| 9 | + <div class="screen layout"> |
| 10 | + ${Block("tl", [ |
| 11 | + "System status", |
| 12 | + "Grid Movement: Online", |
| 13 | + "Camera: Online", |
| 14 | + "Freelook: Offline", |
| 15 | + "Chromatic Vision: Offline", |
| 16 | + ])} |
| 17 | + ${Block("tm", [ |
| 18 | + "N ----- NE ----- E", |
| 19 | + ], {justify: "center"})} |
| 20 | + ${Block("tr", [ |
| 21 | + (new Date()).toString() |
| 22 | + ], {justify: "end"})} |
| 23 | + ${Block("ml", [ |
| 24 | + "Active objectives", |
| 25 | + "1. Enhance capabilities", |
| 26 | + "2. Locate exit", |
| 27 | + "3. Init logout sequence", |
| 28 | + ])} |
| 29 | + ${Block("mr", [ |
| 30 | + "Running analysis", |
| 31 | + "Assessment complete", |
| 32 | + "<div class=box>No threats found</div>", |
| 33 | + ])} |
| 34 | + ${Block("bl", [ |
| 35 | + "Tracking", |
| 36 | + "0.02 13.27 1.03", |
| 37 | + "2.98 91.34 12.81", |
| 38 | + "0.18 63.06 22.84", |
| 39 | + ], {align: "end"})} |
| 40 | + ${Block("br", new Array(10).fill(""), {align: "end"})} |
| 41 | + </div> |
| 42 | + `; |
| 43 | +} |
| 44 | + |
| 45 | +let root = document.querySelector("#root"); |
| 46 | + |
| 47 | +let interval; |
| 48 | +root.addEventListener("beforerender", function() { |
| 49 | + clearInterval(interval); |
| 50 | +}); |
| 51 | +root.addEventListener("afterrender", function() { |
| 52 | + interval = setInterval(() => { |
| 53 | + let div = document.createElement("div"); |
| 54 | + |
| 55 | + // Animate code display |
| 56 | + let br = root.querySelector(".br"); |
| 57 | + br.removeChild(br.firstElementChild); |
| 58 | + div.innerHTML = Line(code_anim.next().value); |
| 59 | + br.appendChild(div.firstElementChild); |
| 60 | + |
| 61 | + // Update datetime |
| 62 | + let tr = root.querySelector(".tr .glitch"); |
| 63 | + for (let child of tr.children) { |
| 64 | + child.textContent = (new Date()).toString(); |
| 65 | + } |
| 66 | + }, 1000); |
| 67 | +}); |
0 commit comments