-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from Kerosene-Labs/BIL-6-update-fixed
BIL-6: adding page transition
- Loading branch information
Showing
6 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,61 @@ | ||
<script lang="ts"> | ||
import "../app.css"; | ||
import ToastQueue from "$lib/tk/ToastQueue.svelte"; | ||
import { onNavigate } from "$app/navigation"; | ||
let { children } = $props(); | ||
onNavigate((navigation) => { | ||
if (!document.startViewTransition) return; | ||
return new Promise((resolve) => { | ||
document.startViewTransition(async () => { | ||
resolve(); | ||
await navigation.complete; | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
<ToastQueue></ToastQueue> | ||
{@render children()} | ||
|
||
<style lang="postcss"> | ||
@keyframes fade-in { | ||
from { | ||
opacity: 0; | ||
} | ||
} | ||
@keyframes fade-out { | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
@keyframes in { | ||
from { | ||
transform: translateY(30px); | ||
} | ||
} | ||
@keyframes out { | ||
to { | ||
transform: translateY(-30px); | ||
} | ||
} | ||
:root::view-transition-old(root) { | ||
animation: | ||
90ms cubic-bezier(0.4, 0, 1, 1) both fade-out, | ||
300ms cubic-bezier(0.4, 0, 0.2, 1) both out; | ||
} | ||
:root::view-transition-new(root) { | ||
animation: | ||
210ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in, | ||
300ms cubic-bezier(0.4, 0, 0.2, 1) both in; | ||
} | ||
</style> |