WIP on performances
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-16 16:40:33 +02:00
parent f91dc8541b
commit 7f3f2ac3ba
9 changed files with 60 additions and 47 deletions

View File

@@ -3,7 +3,7 @@
import { fly, fade } from 'svelte/transition'
import { quartInOut, quartOut } from 'svelte/easing'
import { stores } from '@sapper/app'
import { pageReady, firstLoad, animDelayPanel } from 'utils/store'
import { pageReady, firstLoad, animPanelDelay } from 'utils/store'
const { page } = stores()
// Animations
@@ -14,30 +14,31 @@
import IconGlobe from 'atoms/IconGlobe'
// Props and Variables
export let animateIn = scope => {}
export let animateIn = (scope) => {}
let scope
let show = false
// Listen for when a route is mounted
pageReady.subscribe(loaded => {
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
requestAnimationFrame(() => animateIn(scope))
}, animDelayPanel)
if (loaded) {
setTimeout(() => {
// Display page content
show = true
// Run the page animation / after a tiny delay
requestAnimationFrame(() => animateIn(scope))
// Change loader icon as the loader shown already
firstLoad.set(false)
// Scroll to page top
window.scrollTo(0,0)
}, animPanelDelay)
}
})
</script>
{#if show || !process.browser}
<slot />
{:else}
{#if !show && process.browser}
<div class="transition" id="transition" aria-hidden="true" bind:this={scope}>
<div class="transition__loader"
in:fly={{ y: 32, duration: 1000, easing: quartOut }}

View File

@@ -33,6 +33,6 @@ export let fullscreen = writable()
Animation related
========================================================================== */
export const animDelay = 800
export const animDelayPanel = 1000
export const animPanelDelay = 1000
export const animDuration = 1400
export const animDurationLong = 1800