TitleSite: Fix longer delay after first transition
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-21 15:05:33 +02:00
parent 5b4fe1c6d6
commit ecc69e3206
3 changed files with 21 additions and 11 deletions

View File

@@ -5,9 +5,11 @@
import {
pageReady,
pageAnimation,
firstLoad,
animDuration,
animDelay,
animPanelDelay
animPanelDelay,
animPanelShortDelay
} from 'utils/store'
// Components
import TitleSite from 'atoms/TitleSite'
@@ -20,7 +22,6 @@
$: animateIn = $pageAnimation
let scope
let show = false
let firstLoad = true
let previousPage = ''
// Check if path is excluded
@@ -31,7 +32,9 @@
// Show transition if page is not excluded
if (!isExcluded(previousPage) || !isExcluded(page.path)) {
pageReady.set(false)
process.browser && requestAnimationFrame(() => show = false)
process.browser && requestAnimationFrame(() => {
show = false
})
}
// Update page for viewer navigation checking
@@ -45,12 +48,12 @@
// Show transition
show = true
// Run the page animation
process.browser && requestAnimationFrame(() => animateIn())
process.browser && requestAnimationFrame(animateIn)
// Change loader icon as the loader shown already
firstLoad = false
firstLoad.set(false)
// Scroll to page top
window.scrollTo(0,0)
}, firstLoad ? animPanelDelay : 600)
}, $firstLoad ? animPanelDelay : animPanelShortDelay)
}
})
</script>
@@ -61,7 +64,7 @@
in:fly={{ y: 24, duration: 800, easing: quartOut }}
out:fly={{ y: -window.innerHeight/2, duration: animDuration, easing: quartInOut }}
>
{#if firstLoad}
{#if $firstLoad}
<TitleSite init={true} />
{:else}
<IconGlobe width="44" color="#fff" animated="true" />

View File

@@ -24,15 +24,17 @@ export let currentLocation = writable()
export let currentPhotos = writable()
// State
export let pageReady = writable(false, () => {})
export let fullscreen = writable(undefined, () => {})
/* ==========================================================================
Animation related
========================================================================== */
export let firstLoad = writable(true, () => {})
export let pageReady = writable(false, () => {})
export let pageAnimation = writable(() => {}, () => {})
export const animDelay = 900
export const animPanelDelay = 900
export const animPanelShortDelay = 600
export const animDuration = 1400
export const animDurationLong = 1800