Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 651858f

Browse files
committed
💄 Add display animations to fsDisp
1 parent b2cfc83 commit 651858f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/assets/css/filesystem.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ div#fs_disp_container > * {
4343
align-items: center;
4444
justify-content: center;
4545
cursor: pointer;
46+
opacity: 1;
47+
transition: opacity .2s linear;
48+
}
49+
50+
div#fs_disp_container > *.animationWait {
51+
opacity: 0 !important;
4652
}
4753

4854
div#fs_disp_container > *:active {

src/classes/filesystem.class.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class FilesystemDisplay {
235235
});
236236
};
237237

238-
this.render = (blockList) => {
238+
this.render = async blockList => {
239239
if (this.failed === true) return false;
240240

241241
document.getElementById("fs_disp_title_dir").innerText = this.dirpath;
@@ -338,7 +338,7 @@ class FilesystemDisplay {
338338
break;
339339
}
340340

341-
filesDOM += `<div class="fs_disp_${e.type}${hidden}" onclick="${cmd}">
341+
filesDOM += `<div class="fs_disp_${e.type}${hidden} animationWait" onclick="${cmd}">
342342
<svg viewBox="0 0 24.00 24.00">${icon}</svg>
343343
<h3>${e.name}</h3>
344344
</div>`;
@@ -367,6 +367,19 @@ class FilesystemDisplay {
367367
this.space_bar.bar.value = 100;
368368
}
369369
}
370+
371+
function delay(ms) {
372+
return new Promise((resolve, reject) => {
373+
setTimeout(resolve, ms);
374+
});
375+
}
376+
// Render animation
377+
let id = 0;
378+
while (this.filesContainer.childNodes[id]) {
379+
this.filesContainer.childNodes[id].setAttribute("class", this.filesContainer.childNodes[id].getAttribute("class").replace(" animationWait", ""));
380+
await delay(50);
381+
id++;
382+
}
370383
};
371384

372385
// Automatically start indexing supposed beginning CWD

0 commit comments

Comments
 (0)