An Electron-based JLD2 data file viewer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

spinning_wheel.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Author: Jared Goodwin
  2. // showLoading() - Display loading wheel.
  3. // Requires ECMAScript 6 (any modern browser).
  4. function showLoading() {
  5. if (document.getElementById("divLoadingFrame") != null) {
  6. return;
  7. }
  8. var style = document.createElement("style");
  9. style.id = "styleLoadingWindow";
  10. style.innerHTML = `
  11. .loading-frame {
  12. position: fixed;
  13. background-color: rgba(0, 0, 0, 0.5);
  14. left: 0;
  15. top: 0;
  16. right: 0;
  17. bottom: 0;
  18. z-index: 4;
  19. }
  20. .loading-track {
  21. height: 50px;
  22. display: inline-block;
  23. position: absolute;
  24. top: calc(50% - 50px);
  25. left: 50%;
  26. }
  27. .loading-dot {
  28. height: 5px;
  29. width: 5px;
  30. background-color: white;
  31. border-radius: 100%;
  32. opacity: 0;
  33. }
  34. .loading-dot-animated {
  35. animation-name: loading-dot-animated;
  36. animation-direction: alternate;
  37. animation-duration: .75s;
  38. animation-iteration-count: infinite;
  39. animation-timing-function: ease-in-out;
  40. }
  41. @keyframes loading-dot-animated {
  42. from {
  43. opacity: 0;
  44. }
  45. to {
  46. opacity: 1;
  47. }
  48. }
  49. `
  50. document.body.appendChild(style);
  51. var frame = document.createElement("div");
  52. frame.id = "divLoadingFrame";
  53. frame.classList.add("loading-frame");
  54. for (var i = 0; i < 10; i++) {
  55. var track = document.createElement("div");
  56. track.classList.add("loading-track");
  57. var dot = document.createElement("div");
  58. dot.classList.add("loading-dot");
  59. track.style.transform = "rotate(" + String(i * 36) + "deg)";
  60. track.appendChild(dot);
  61. frame.appendChild(track);
  62. }
  63. document.body.appendChild(frame);
  64. var wait = 0;
  65. var dots = document.getElementsByClassName("loading-dot");
  66. for (var i = 0; i < dots.length; i++) {
  67. window.setTimeout(function(dot) {
  68. dot.classList.add("loading-dot-animated");
  69. }, wait, dots[i]);
  70. wait += 150;
  71. }
  72. }