Skip to content

Commit

Permalink
Loading fade out animation
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGough committed Jul 28, 2023
1 parent 2d31acb commit ad67428
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Solar System Model</title>
<link rel="stylesheet" href="./style.scss" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Trispace:wght@200;500;800&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="./style.scss" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<div id="loading">
Expand Down
14 changes: 13 additions & 1 deletion src/setup/loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ export const onLoaded = () => {
loadContainer.style.cursor = "pointer";

loadContainer.addEventListener("click", () => {
loadContainer.style.display = "none";
loadContainer.style.pointerEvents = "none";
const animation = loadContainer.animate(
{ opacity: [1, 0], transform: ["scale(1)", "scale(0.75)"] },
{
duration: 750,
easing: "ease",
fill: "forwards",
}
);

animation.onfinish = () => {
loadContainer.style.display = "none";
};
});
};

0 comments on commit ad67428

Please sign in to comment.