Skip to content

Commit

Permalink
Update loading animation
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeChen committed Dec 1, 2024
1 parent a9e1665 commit a3a0288
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
61 changes: 61 additions & 0 deletions CascadingStyleSheets/General/loadingAnimation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

#box_LoadingAnimation {

position: fixed;

top: 0;
left: 0;

width: 100vw;
height: 100vh;

z-index: 20001;

background: rgba(0, 0, 0, 0.5);

display: none;
}

#box_LoadingAnimation.waitToDisplay {

display: block;
opacity: 0;

transition: all 0.5s;
}

#box_LoadingAnimation.display {

display: block;
opacity: 1;

transition: all 0.5s;
}

@keyframes loadingAnimation {

0% {
transform: rotate(0deg);
}

100% {

transform: rotate(360deg);
}
}

#box_LoadingAnimation img {

position: absolute;

height: 15%;

top: 0;
left: 0;
bottom: 0;
right: 0;

margin: auto;

animation: loadingAnimation 3s infinite linear;
}
Binary file added File/Image/loading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions JavaScript/Projects/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ const SeeChen_ProjectsMouseEvent = {

// await window.router.route(`/projects/${e.target.dataset.id}/`, false);

document.querySelector("#box_LoadingAnimation").classList.add("waitToDisplay");
await new Promise(r => setTimeout(r, 100));
document.querySelector("#box_LoadingAnimation").classList.add("display");

var oldProjectDetails = window.myTools.deepCopy(window.myData.projects.currentDetails);

window.myData.projects.currentDetails.children[0].children[1].lang = "projectName";
Expand Down Expand Up @@ -392,6 +396,10 @@ const SeeChen_ProjectsMouseEvent = {
setTimeout(() => {
document.querySelector("#project_details").classList.add("full-window");
}, 100);

document.querySelector("#box_LoadingAnimation").classList.remove("display");
await new Promise(r => setTimeout(r, 600));
document.querySelector("#box_LoadingAnimation").classList.remove("waitToDisplay");
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion spa.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<link rel="stylesheet" href="/CascadingStyleSheets/General/navigation.css" type="text/css">

<link rel="stylesheet" href="/CascadingStyleSheets/General/loading.css" type="text/css">
<link rel="stylesheet" href="/CascadingStyleSheets/General/loadingAnimation.css" type="text/css">

<link rel="stylesheet" href="/CascadingStyleSheets/General/footer.css" type="text/css">

Expand Down Expand Up @@ -70,6 +71,9 @@

<body>

<div id="box_LoadingAnimation">
<img src="/File/Image/loading.png" alt="">
</div>
<!-- Loading Pages -->
<div id="box_loading"></div>

Expand All @@ -95,7 +99,6 @@

<!-- Footer Area -->
<div id="box_footerArea" class="notInDisplay"></div>

</div>
</body>
</html>
Expand Down

0 comments on commit a3a0288

Please sign in to comment.