DISTRHO Plugin Framework
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.

133 lines
3.4KB

  1. <!DOCTYPE html>
  2. <html lang="">
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <script>
  7. const METER_COLOR_GREEN = 0;
  8. const METER_COLOR_BLUE = 1;
  9. const kSmoothMultiplier = 3.0;
  10. let fColorValue = null;
  11. let fColor = 'rgb(93, 231, 61)';
  12. let fOutLeft = 0.0;
  13. let fOutRight = 0.0;
  14. setTimeout(function() {
  15. document.getElementById('user-agent').textContent = window.navigator.userAgent;
  16. }, 1)
  17. function repaint() {
  18. const lmeter = document.getElementById('left-meter-x');
  19. const rmeter = document.getElementById('right-meter-x');
  20. lmeter.setAttribute('style', 'background:' + fColor + ';top:' + (100 * (1.0 - fOutLeft)) + '%;height:' + (100 * fOutLeft) + '%');
  21. rmeter.setAttribute('style', 'background:' + fColor + ';top:' + (100 * (1.0 - fOutRight)) + '%;height:' + (100 * fOutRight) + '%');
  22. }
  23. function updateColor(color) {
  24. if (fColorValue === color)
  25. return;
  26. fColorValue = color;
  27. switch (color) {
  28. case METER_COLOR_GREEN:
  29. fColor = "rgb(93, 231, 61)";
  30. break;
  31. case METER_COLOR_BLUE:
  32. fColor = "rgb(82, 238, 248)";
  33. break;
  34. }
  35. repaint();
  36. }
  37. function parameterChanged(index, value) {
  38. switch (index) {
  39. case 0: // color
  40. updateColor(parseInt(Math.round(value)));
  41. break;
  42. case 1: // out-left
  43. value = (fOutLeft * kSmoothMultiplier + value) / (kSmoothMultiplier + 1.0);
  44. /**/ if (value < 0.001) value = 0.0;
  45. else if (value > 0.999) value = 1.0;
  46. if (fOutLeft != value)
  47. {
  48. fOutLeft = value;
  49. repaint();
  50. }
  51. break;
  52. case 2: // out-right
  53. value = (fOutRight * kSmoothMultiplier + value) / (kSmoothMultiplier + 1.0);
  54. /**/ if (value < 0.001) value = 0.0;
  55. else if (value > 0.999) value = 1.0;
  56. if (fOutRight != value)
  57. {
  58. fOutRight = value;
  59. repaint();
  60. }
  61. break;
  62. }
  63. }
  64. </script>
  65. <style>
  66. html, body {
  67. background: grey;
  68. color: white;
  69. margin: 0;
  70. padding: 0;
  71. }
  72. body {
  73. display: flex;
  74. flex-direction: column;
  75. }
  76. p {
  77. margin: 6px;
  78. font-size: 15px;
  79. overflow: hidden;
  80. text-overflow: ellipsis;
  81. width: calc(100% - 12px);
  82. height: 15px;
  83. white-space: nowrap;
  84. }
  85. #meters {
  86. display: flex;
  87. flex-direction: row;
  88. }
  89. .meter {
  90. background: black;
  91. margin: 6px;
  92. margin-top: 0px;
  93. width: calc(50vw - 9px);
  94. height: calc(100vh - 12px - 6px - 15px);
  95. }
  96. .meter:first-child {
  97. margin-right: 3px;
  98. }
  99. .meter:last-child {
  100. margin-left: 3px;
  101. }
  102. .meter-x {
  103. background: rgb(93, 231, 61);
  104. position: relative;
  105. top: 0%;
  106. left: 0;
  107. width: 100%;
  108. height: 0%;
  109. }
  110. </style>
  111. </head>
  112. <body>
  113. <p id="user-agent">&nbsp;</p>
  114. <div id="meters">
  115. <div class="meter" id="left-meter">
  116. <div class="meter-x" id="left-meter-x"></div>
  117. </div>
  118. <div class="meter" id="right-meter">
  119. <div class="meter-x" id="right-meter-x"></div>
  120. </div>
  121. </div>
  122. </body>
  123. </html>