Fix pages and components animations
- Fix delays - Add the init back for TitleSite as it needs a delay for the page instance vs. loader
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { fly, fade } from 'svelte/transition'
|
||||
import { quartInOut, quartOut } from 'svelte/easing'
|
||||
import { stores } from '@sapper/app'
|
||||
import { pageReady, firstLoad } from 'utils/store'
|
||||
import { pageReady, firstLoad, animDelayPanel } from 'utils/store'
|
||||
const { page } = stores()
|
||||
|
||||
// Animations
|
||||
@@ -21,27 +21,30 @@
|
||||
|
||||
// Listen for when a route is mounted
|
||||
pageReady.subscribe(loaded => {
|
||||
if (loaded) {
|
||||
setTimeout(() => {
|
||||
show = true
|
||||
firstLoad.set(false)
|
||||
setTimeout(() => animateIn(scope), 1)
|
||||
}, 1000)
|
||||
}
|
||||
loaded && setTimeout(() => {
|
||||
// Display page content
|
||||
show = true
|
||||
// Change loader icon as the loader shown already
|
||||
firstLoad.set(false)
|
||||
// Scroll to page top
|
||||
window.scrollTo(0,0)
|
||||
// Run the page animation / after a tiny delay
|
||||
setTimeout(() => animateIn(scope), 1)
|
||||
}, animDelayPanel)
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if show || !process.browser}
|
||||
<slot></slot>
|
||||
<slot />
|
||||
|
||||
{:else}
|
||||
<div class="transition" id="transition" aria-hidden="true" bind:this={scope}>
|
||||
<div class="transition__loader"
|
||||
in:fly={{ y: 24, duration: 800, easing: quartOut }}
|
||||
in:fly={{ y: 32, duration: 1000, easing: quartOut }}
|
||||
out:fly={{ y: -window.innerHeight/2, duration: 1400, easing: quartInOut }}
|
||||
>
|
||||
{#if $firstLoad}
|
||||
<TitleSite />
|
||||
<TitleSite init={true} />
|
||||
{:else}
|
||||
<IconGlobe width="44" color="#fff" animated="true" />
|
||||
{/if}
|
||||
|
||||
@@ -33,5 +33,6 @@ export let fullscreen = writable()
|
||||
Animation related
|
||||
========================================================================== */
|
||||
export const animDelay = 800
|
||||
export const animDelayPanel = 1000
|
||||
export const animDuration = 1400
|
||||
export const animDurationLong = 1800
|
||||
|
||||
Reference in New Issue
Block a user