You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
4.9KB

  1. <!doctype html>
  2. <html lang="en-us">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>Cardinal Synth</title>
  7. <style>
  8. html {
  9. background-color: #111;
  10. color: #eee;
  11. }
  12. body, canvas {
  13. padding: 0;
  14. margin: 0;
  15. }
  16. #canvas_wrapper {
  17. display: none;
  18. width: 100vw;
  19. height: 100vh;
  20. }
  21. .emscripten {
  22. display: block;
  23. margin-left: auto;
  24. margin-right: auto;
  25. padding-right: 0;
  26. text-align: center;
  27. }
  28. .spinner {
  29. height: 50px;
  30. width: 50px;
  31. margin: 0px auto;
  32. margin-top: 100px;
  33. -webkit-animation: rotation .8s linear infinite;
  34. -moz-animation: rotation .8s linear infinite;
  35. -o-animation: rotation .8s linear infinite;
  36. animation: rotation 0.8s linear infinite;
  37. border-left: 10px solid rgb(0,150,240);
  38. border-right: 10px solid rgb(0,150,240);
  39. border-bottom: 10px solid rgb(0,150,240);
  40. border-top: 10px solid rgb(100,0,200);
  41. border-radius: 100%;
  42. background-color: rgb(200,100,250);
  43. }
  44. @-webkit-keyframes rotation {
  45. from {-webkit-transform: rotate(0deg);}
  46. to {-webkit-transform: rotate(360deg);}
  47. }
  48. @-moz-keyframes rotation {
  49. from {-moz-transform: rotate(0deg);}
  50. to {-moz-transform: rotate(360deg);}
  51. }
  52. @-o-keyframes rotation {
  53. from {-o-transform: rotate(0deg);}
  54. to {-o-transform: rotate(360deg);}
  55. }
  56. @keyframes rotation {
  57. from {transform: rotate(0deg);}
  58. to {transform: rotate(360deg);}
  59. }
  60. </style>
  61. </head>
  62. <body>
  63. <figure style="overflow:visible;" id="spinner">
  64. <div class="spinner"></div>
  65. <center style="margin-top:0.5em"><strong>Cardinal</strong></center>
  66. </figure>
  67. <div class="emscripten" id="status">Downloading...</div>
  68. <div class="emscripten">
  69. <progress value="0" max="100" id="progress" hidden=1></progress>
  70. </div>
  71. <div id="canvas_wrapper">
  72. <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
  73. </div>
  74. <script type='text/javascript'>
  75. var statusElement = document.getElementById('status');
  76. var progressElement = document.getElementById('progress');
  77. var spinnerElement = document.getElementById('spinner');
  78. var Module = {
  79. preRun: [],
  80. postRun: function() {
  81. var canvasWrapper = document.getElementById('canvas_wrapper');
  82. canvasWrapper.style.display = 'block';
  83. window.dispatchEvent(new Event('resize'));
  84. },
  85. canvas: (function() {
  86. var canvas = document.getElementById('canvas');
  87. // As a default initial behavior, pop up an alert when webgl context is lost. To make your
  88. // application robust, you may want to override this behavior before shipping!
  89. // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
  90. canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
  91. return canvas;
  92. })(),
  93. setStatus: function(text) {
  94. if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
  95. if (text === Module.setStatus.last.text) return;
  96. var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
  97. var now = Date.now();
  98. if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
  99. Module.setStatus.last.time = now;
  100. Module.setStatus.last.text = text;
  101. if (m) {
  102. text = m[1];
  103. progressElement.value = parseInt(m[2])*100;
  104. progressElement.max = parseInt(m[4])*100;
  105. progressElement.hidden = false;
  106. spinnerElement.hidden = false;
  107. } else {
  108. progressElement.value = null;
  109. progressElement.max = null;
  110. progressElement.hidden = true;
  111. if (!text) spinnerElement.hidden = true;
  112. }
  113. statusElement.innerHTML = text;
  114. },
  115. totalDependencies: 0,
  116. monitorRunDependencies: function(left) {
  117. this.totalDependencies = Math.max(this.totalDependencies, left);
  118. Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
  119. }
  120. };
  121. Module.setStatus('Downloading...');
  122. window.onerror = function() {
  123. Module.setStatus('Exception thrown, see JavaScript console');
  124. spinnerElement.style.display = 'none';
  125. Module.setStatus = function(text) {
  126. if (text) console.error('[post-exception status] ' + text);
  127. };
  128. };
  129. </script>
  130. {{{ SCRIPT }}}
  131. </body>
  132. </html>