cute progress bar animations

This commit is contained in:
Matt Walsh
2022-08-05 15:53:16 -05:00
parent 8cc6e4a1eb
commit 068d3a438c
4 changed files with 7 additions and 6 deletions

View File

@@ -75,13 +75,13 @@ class Progress extends WeatherDisplay {
// calculate loaded percent
const loadedPercent = (loadedCount / displays.length);
this.progressCover.style.width = `${(1.0 - loadedPercent) * 100}%`;
if (loadedPercent < 1.0) {
// show the progress bar and set width
this.progressCover.parentNode.classList.add('show');
this.progressCover.style.width = `${(1.0 - loadedPercent) * 100}%`;
} else {
// hide the progressbar
this.progressCover.parentNode.classList.remove('show');
// hide the progressbar after 1 second (lines up with with width transition animation)
setTimeout(() => this.progressCover.parentNode.classList.remove('show'), 1000);
}
}