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

@@ -10,7 +10,7 @@ export const animateIn = scope => {
const tl = anime.timeline({ const tl = anime.timeline({
easing: 'easeOutQuart', easing: 'easeOutQuart',
duration: animDuration, duration: animDuration,
delay: animDelay, // delay: animDelay,
autoplay: false autoplay: false
}) })

View File

@@ -18,7 +18,7 @@ export const animateIn = () => {
duration: animDuration duration: animDuration
}) })
// Parallax on scroll // Title: Parallax on scroll
const translate = anime({ const translate = anime({
targets: '#title-houses', targets: '#title-houses',
translateX: ['7%', '-15%'], translateX: ['7%', '-15%'],

View File

@@ -22,34 +22,30 @@
** Run code when mounted ** Run code when mounted
*/ */
onMount(async () => { onMount(async () => {
// For browser only // Import libraries and code
if (process.browser) { let InteractiveGlobe
// Import libraries and code await import('globe/index').then(module => InteractiveGlobe = module.default)
let Globe // Init the globe from library
await import('globe').then(module => Globe = module.default) globe = new InteractiveGlobe({
el: scope,
texture: `/img/globe/map-${window.innerWidth >= 992 ? '3k' : '2k'}.png`,
markers: [...$locations.map(location => {
return {
name: location.name,
slug: location.slug,
countryName: location.country.name,
countrySlug: location.country.slug,
lat: location.coordinates.lat,
lng: location.coordinates.lng
}
})],
cameraDistance: 3,
onLinkClicked: () => {}
})
// Init the globe from library // Run the globe
globe = new Globe({ resize()
el: scope, update()
texture: `/img/globe/map-${window.innerWidth >= 992 ? '4k' : '2k'}.png`,
markers: [...$locations.map(location => {
return {
name: location.name,
slug: location.slug,
countryName: location.country.name,
countrySlug: location.country.slug,
lat: location.coordinates.lat,
lng: location.coordinates.lng
}
})],
cameraDistance: 3,
onLinkClicked: () => {}
})
// Run the globe
resize()
update()
}
}) })
</script> </script>

View File

@@ -54,7 +54,7 @@
<source media="(min-width: 768px)" data-srcset={getThumbnail(private_hash, 992)}> <source media="(min-width: 768px)" data-srcset={getThumbnail(private_hash, 992)}>
<source media="(min-width: 500px)" data-srcset={getThumbnail(private_hash, 650)}> <source media="(min-width: 500px)" data-srcset={getThumbnail(private_hash, 650)}>
<source media="(min-width: 300px)" data-srcset={getThumbnail(private_hash, 400)}> <source media="(min-width: 300px)" data-srcset={getThumbnail(private_hash, 400)}>
<img src={getThumbnail(private_hash, 900)} <img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
width={defaultWidth} height={defaultHeight} width={defaultWidth} height={defaultHeight}
alt={imgAlt} alt={imgAlt}
class:lazyload={layout === 'list'} class:lazyload={layout === 'list'}

View File

@@ -159,7 +159,7 @@
<source media="(min-width: 800px)" data-srcset={getThumbnail(image.private_hash, 900)}> <source media="(min-width: 800px)" data-srcset={getThumbnail(image.private_hash, 900)}>
<source media="(min-width: 500px)" data-srcset={getThumbnail(image.private_hash, 600)}> <source media="(min-width: 500px)" data-srcset={getThumbnail(image.private_hash, 600)}>
<source media="(min-width: 300px)" data-srcset={getThumbnail(image.private_hash, 400)}> <source media="(min-width: 300px)" data-srcset={getThumbnail(image.private_hash, 400)}>
<img src={getThumbnail(image.private_hash, 900)} <img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
alt="{name}, {location.name}, {location.country.name}" alt="{name}, {location.name}, {location.country.name}"
width={defaultWidth} height={defaultHeight} width={defaultWidth} height={defaultHeight}
class:lazyload={ class:lazyload={

View File

@@ -32,6 +32,8 @@
pageReady pageReady
} from 'utils/store' } from 'utils/store'
import { charsToSpan, smoothScroll } from 'utils/functions' import { charsToSpan, smoothScroll } from 'utils/functions'
// Dependencies
import ScrollOut from 'scroll-out'
// Components // Components
import Button from 'atoms/Button' import Button from 'atoms/Button'
import IconGlobeSmall from 'atoms/IconGlobeSmall' import IconGlobeSmall from 'atoms/IconGlobeSmall'
@@ -49,6 +51,10 @@
// Props and Variables // Props and Variables
export let photos = '' export let photos = ''
const { page } = stores() const { page } = stores()
// let Carousel
// let Fullscreen
// let InteractiveGlobe
// let Locations
// Reset current location if existing // Reset current location if existing
currentLocation.set() currentLocation.set()
@@ -58,7 +64,13 @@
/* /*
** Run code when mounted ** Run code when mounted
*/ */
onMount(() => { onMount(async () => {
// Load components
// await import('organisms/Carousel').then(module => Carousel = module.default)
// await import('organisms/Fullscreen').then(module => Fullscreen = module.default)
// await import('molecules/InteractiveGlobe').then(module => InteractiveGlobe = module.default)
// await import('organisms/Locations').then(module => Locations = module.default)
// Page is loaded // Page is loaded
pageReady.set(true) pageReady.set(true)
}) })
@@ -97,7 +109,9 @@
<div id="intro-carousel"> <div id="intro-carousel">
<Carousel {photos} locationUrl={true} /> <Carousel {photos} locationUrl={true} />
<!-- <svelte:component this={Carousel} {photos} locationUrl={true} /> -->
<Fullscreen /> <Fullscreen />
<!-- <svelte:component this={Fullscreen} /> -->
</div> </div>
</section> </section>
@@ -113,6 +127,7 @@
</div> </div>
<InteractiveGlobe /> <InteractiveGlobe />
<!-- <svelte:component this={InteractiveGlobe} /> -->
<div class="anim-mask anim-title"> <div class="anim-mask anim-title">
<h1 class="title-massive title-parallax" id="title-world" aria-label="World"> <h1 class="title-massive title-parallax" id="title-world" aria-label="World">
@@ -121,6 +136,7 @@
</div> </div>
<Locations /> <Locations />
<!-- <svelte:component this={Locations} /> -->
</section> </section>
<Footer /> <Footer />

View File

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

View File

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

BIN
static/img/globe/map-3k.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB