diff --git a/src/interface.js b/src/interface.js index 4f5f112..77eda9a 100644 --- a/src/interface.js +++ b/src/interface.js @@ -58,10 +58,20 @@ class InterfaceElement { return this.#hidden; } set hidden(x) { + if (this.#hidden === x) return; + this.#hidden = x; for (const node of this.rootNodes) { - node.hidden = this.hidden; + if (this.hidden) { + node.classList.add("visualhidden"); + node.classList.add("hidden"); + } else { + node.classList.remove("hidden"); + setTimeout(function() { + node.classList.remove("visualhidden"); + }, 20); + } } if (this.hidden === true) this.clearAlerts(); diff --git a/src/style.css b/src/style.css index 63c73f0..9ac474c 100644 --- a/src/style.css +++ b/src/style.css @@ -4,11 +4,7 @@ body { padding: 0 10px; color: #444444; background: #eeeeee; - animation: fadeIn 0.5s; -} -@keyframes fadeIn { - 0% {opacity: 0;} - 100% {opacity: 1;} + transition: all 0.5s; } body, button { @@ -160,24 +156,9 @@ button:active { } } -[hidden] { - animation: fadeOut 0.2s, disappear 0.3s; +.visualhidden { opacity: 0; - visibility: hidden; - max-height: 0 !important; - margin: 0 !important; - padding: 0 !important; } -@keyframes fadeOut { - 0% {opacity: 1; visibility: visible;} - 100% {opacity: 0; visibility: hidden;} -} -@keyframes disappear { - 0% { - max-height: 100em; - } - 100% { - max-height: 0; - margin: 0; - } +.hidden { + display: none; }