⚠️ Rework completely how transitions works
- Use Svelte/Sapper native if and transitions to show either the page content or the loader, then load each page animationIn - Code is safe on SSR side, using process.browser on this if - The <main> element is on position absolute to fade nicely the different pages - Code cleaning
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
export let href = '#'
|
export let href = '#'
|
||||||
export let type = 'a'
|
export let type = 'a'
|
||||||
export let text = ''
|
export let text = ''
|
||||||
export let noScroll = null
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if type === 'button'}
|
{#if type === 'button'}
|
||||||
@@ -14,7 +13,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<a {href} class={$$props.class ? $$props.class : 'button'} sapper-noscroll={noScroll} on:click>
|
<a {href} class={$$props.class ? $$props.class : 'button'} on:click>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
<div class="text" data-text={text}>
|
<div class="text" data-text={text}>
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
export let href = '#'
|
export let href = '#'
|
||||||
export let text = ''
|
export let text = ''
|
||||||
export let noScroll = null
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href={href} class="link-change" sapper-noscroll={noScroll}>
|
<a href={href} class="link-change">
|
||||||
{text}
|
{text}
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
export let text = ''
|
export let text = ''
|
||||||
export let target = null
|
export let target = null
|
||||||
export let rel = null
|
export let rel = null
|
||||||
export let noScroll = null
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a class="link-translate" {href} {target} {rel} sapper-noscroll={noScroll}>
|
<a class="link-translate" {href} {target} {rel}>
|
||||||
<slot />
|
<slot />
|
||||||
<div class="text" data-text={text}>
|
<div class="text" data-text={text}>
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
|
|||||||
@@ -6,28 +6,30 @@
|
|||||||
import { animateIn } from 'animations/TitleSite'
|
import { animateIn } from 'animations/TitleSite'
|
||||||
|
|
||||||
// Props and variables
|
// Props and variables
|
||||||
export let init = false
|
|
||||||
let scope
|
|
||||||
let mounted = false
|
let mounted = false
|
||||||
|
let scope
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Run code on component mount
|
** Run code when mounted
|
||||||
*/
|
*/
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
animateIn(scope, init)
|
animateIn(scope)
|
||||||
mounted = true
|
mounted = true
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="title-location title-location--inline" bind:this={scope} style="opacity: {mounted ? 1 : 0}">
|
<div class="title-location title-location--inline"
|
||||||
|
bind:this={scope}
|
||||||
|
style="opacity: {mounted ? 1 : 0}"
|
||||||
|
>
|
||||||
<div role="heading" aria-level="1" aria-label="Houses">
|
<div role="heading" aria-level="1" aria-label="Houses">
|
||||||
<div class="anim-mask">
|
<div class="anim-mask">
|
||||||
{@html charsToSpan('Houses')}
|
{@html charsToSpan('Houses')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<em>
|
<em class="anim-mask">
|
||||||
<span>of</span>
|
<span>of</span>
|
||||||
<span>the</span>
|
<span>the</span>
|
||||||
</em>
|
</em>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Run code on browser only
|
** Run code when mounted
|
||||||
*/
|
*/
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Get layout setting from storage
|
// Get layout setting from storage
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="location">
|
<div class="location">
|
||||||
<a href="/location/{country.slug}/{slug}" rel="prefetch" sapper-noscroll>
|
<a href="/location/{country.slug}/{slug}" rel="prefetch">
|
||||||
<img src={country.flag.full_url} alt="Flag of {country.name}">
|
<img src={country.flag.full_url} alt="Flag of {country.name}">
|
||||||
<div class="anim-mask mask-city">
|
<div class="anim-mask mask-city">
|
||||||
<h3 class="location__city">{name}</h3>
|
<h3 class="location__city">{name}</h3>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
<div class="photo__image wrap">
|
<div class="photo__image wrap">
|
||||||
<div class="align">
|
<div class="align">
|
||||||
<a href="/viewer/{location.country.slug}/{location.slug}/{photo.slug}" sapper-noscroll>
|
<a href="/viewer/{location.country.slug}/{location.slug}/{photo.slug}">
|
||||||
<picture class="photo__picture">
|
<picture class="photo__picture">
|
||||||
<source media="(min-width: 992px)" data-srcset={getThumbnail(private_hash, 1300)}>
|
<source media="(min-width: 992px)" data-srcset={getThumbnail(private_hash, 1300)}>
|
||||||
<source media="(min-width: 768px)" data-srcset={getThumbnail(private_hash, 992)}>
|
<source media="(min-width: 768px)" data-srcset={getThumbnail(private_hash, 992)}>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<div class="switcher {type}">
|
<div class="switcher {type}">
|
||||||
<div class="switcher__text" class:empty={!location}>
|
<div class="switcher__text" class:empty={!location}>
|
||||||
<a href="/" sapper-noscroll>
|
<a href="/">
|
||||||
{#if !location}
|
{#if !location}
|
||||||
<span class="top">Houses</span>
|
<span class="top">Houses</span>
|
||||||
<span class="bottom">
|
<span class="bottom">
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-control button-control--dashed switcher__icon">
|
<div class="button-control button-control--dashed switcher__icon">
|
||||||
<a href="/choose" aria-label="Change the location" sapper-noscroll>
|
<a href="/choose" aria-label="Change the location">
|
||||||
<IconGlobe
|
<IconGlobe
|
||||||
color={type.includes('side') ? '#333' : '#fff'}
|
color={type.includes('side') ? '#333' : '#fff'}
|
||||||
width={type.includes('side') ? 18 : 24}
|
width={type.includes('side') ? 18 : 24}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
import { stores } from '@sapper/app'
|
import { stores } from '@sapper/app'
|
||||||
import { currentLocation, fullscreen } from 'utils/store'
|
import { currentLocation, fullscreen } from 'utils/store'
|
||||||
import { getThumbnail, formatDate } from 'utils/functions'
|
import { getThumbnail, formatDate } from 'utils/functions'
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
const { page } = stores()
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import SwipeListener from 'swipe-listener'
|
import SwipeListener from 'swipe-listener'
|
||||||
@@ -15,13 +17,9 @@
|
|||||||
import Counter from 'atoms/Counter'
|
import Counter from 'atoms/Counter'
|
||||||
import PaginationDots from 'molecules/PaginationDots'
|
import PaginationDots from 'molecules/PaginationDots'
|
||||||
|
|
||||||
// Props
|
// Props and Variables
|
||||||
export let photos
|
export let photos
|
||||||
export let viewer = false
|
export let viewer = false
|
||||||
|
|
||||||
// Variables
|
|
||||||
const dispatch = createEventDispatcher()
|
|
||||||
const { page } = stores()
|
|
||||||
let scope
|
let scope
|
||||||
let swiped
|
let swiped
|
||||||
let currentIndex = 0
|
let currentIndex = 0
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<LinkTranslate href="/credits" text="Credits" rel="prefetch" noScroll="true" />
|
<LinkTranslate href="/credits" text="Credits" rel="prefetch" />
|
||||||
</li>
|
</li>
|
||||||
{#if $site}
|
{#if $site}
|
||||||
<li class="instagram">
|
<li class="instagram">
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Run code on component mount
|
** Run code when mounted
|
||||||
*/
|
*/
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Entering transition
|
// Entering transition
|
||||||
|
|||||||
@@ -73,14 +73,11 @@
|
|||||||
locations,
|
locations,
|
||||||
pageReady
|
pageReady
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
|
const { page } = stores()
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import Transition from 'utils/Transition'
|
|
||||||
import AnalyticsTracker from 'utils/AnalyticsTracker'
|
import AnalyticsTracker from 'utils/AnalyticsTracker'
|
||||||
|
|
||||||
// Variables
|
|
||||||
const { page } = stores()
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Manipulate data
|
** Manipulate data
|
||||||
@@ -92,7 +89,9 @@
|
|||||||
$countries.forEach(country => {
|
$countries.forEach(country => {
|
||||||
const continent = $continents.find(cont => cont.id === country.continent.id)
|
const continent = $continents.find(cont => cont.id === country.continent.id)
|
||||||
continent.countries = []
|
continent.countries = []
|
||||||
!continent.countries.includes(country) && continent.countries.push(country)
|
if (!continent.countries.includes(country)) {
|
||||||
|
continent.countries.push(country)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Replace each location's country by the database
|
// Replace each location's country by the database
|
||||||
@@ -107,12 +106,12 @@
|
|||||||
<link rel="canonical" href={`https://${$page.host}${$page.path}`} />
|
<link rel="canonical" href={`https://${$page.host}${$page.path}`} />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<main class="housesof" style="opacity: { $pageReady ? 1 : 0}">
|
<main class="housesof"
|
||||||
|
class:is-transitioning={!$pageReady}
|
||||||
|
in:fade={{ duration: 600 }}
|
||||||
|
out:fade={{ duration: 600 }}
|
||||||
|
>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
{#if process.env.CONFIG.TRANSITION === 'true'}
|
|
||||||
<Transition />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<AnalyticsTracker {stores} id={process.env.CONFIG.GA_TRACKER_ID} />
|
<AnalyticsTracker {stores} id={process.env.CONFIG.GA_TRACKER_ID} />
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
site,
|
site,
|
||||||
currentLocation,
|
currentLocation,
|
||||||
currentPhotos,
|
currentPhotos,
|
||||||
pageReady,
|
pageReady
|
||||||
pageTransition
|
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@@ -15,11 +14,11 @@
|
|||||||
import Globe from 'molecules/InteractiveGlobe'
|
import Globe from 'molecules/InteractiveGlobe'
|
||||||
import Locations from 'organisms/Locations'
|
import Locations from 'organisms/Locations'
|
||||||
import Footer from 'organisms/Footer'
|
import Footer from 'organisms/Footer'
|
||||||
|
import Transition from 'utils/Transition'
|
||||||
import SocialMetas from 'utils/SocialMetas'
|
import SocialMetas from 'utils/SocialMetas'
|
||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
import { animateIn } from 'animations/page'
|
import { animateIn } from 'animations/page'
|
||||||
pageTransition.onAnimationEnd = animateIn
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
const { page } = stores()
|
const { page } = stores()
|
||||||
@@ -52,6 +51,7 @@
|
|||||||
/>
|
/>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
<Transition {animateIn}>
|
||||||
<section class="page explore">
|
<section class="page explore">
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<div class="page__top">
|
<div class="page__top">
|
||||||
@@ -74,3 +74,4 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
|
</Transition>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { stores } from '@sapper/app'
|
import { stores } from '@sapper/app'
|
||||||
import { site, pageReady, pageTransition } from 'utils/store'
|
import { site, pageReady } from 'utils/store'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import IconArrow from 'atoms/IconArrow'
|
import IconArrow from 'atoms/IconArrow'
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
import InteractiveGlobe from 'molecules/InteractiveGlobe'
|
import InteractiveGlobe from 'molecules/InteractiveGlobe'
|
||||||
import Footer from 'organisms/Footer'
|
import Footer from 'organisms/Footer'
|
||||||
import SocialMetas from 'utils/SocialMetas'
|
import SocialMetas from 'utils/SocialMetas'
|
||||||
|
import Transition from 'utils/Transition'
|
||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
import { animateIn } from 'animations/page'
|
import { animateIn } from 'animations/page'
|
||||||
pageTransition.onAnimationEnd = animateIn
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
const { page } = stores()
|
const { page } = stores()
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
/>
|
/>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
<Transition>
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<div class="page__top page__part">
|
<div class="page__top page__part">
|
||||||
@@ -81,3 +82,4 @@
|
|||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
</section>
|
</section>
|
||||||
|
</Transition>
|
||||||
|
|||||||
@@ -31,8 +31,7 @@
|
|||||||
site,
|
site,
|
||||||
currentLocation,
|
currentLocation,
|
||||||
currentPhotos,
|
currentPhotos,
|
||||||
pageReady,
|
pageReady
|
||||||
pageTransition
|
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
import { charsToSpan } from 'utils/functions'
|
import { charsToSpan } from 'utils/functions'
|
||||||
|
|
||||||
@@ -53,7 +52,6 @@
|
|||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
import { animateIn } from 'animations/index'
|
import { animateIn } from 'animations/index'
|
||||||
pageTransition.onAnimationEnd = animateIn
|
|
||||||
|
|
||||||
// Props and variables
|
// Props and variables
|
||||||
export let photos = ''
|
export let photos = ''
|
||||||
@@ -86,6 +84,7 @@
|
|||||||
/>
|
/>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
<Transition animateIn={animateIn}>
|
||||||
<section class="intro">
|
<section class="intro">
|
||||||
<div class="anim-mask">
|
<div class="anim-mask">
|
||||||
<div class="anim title-parallax" id="title-houses">
|
<div class="anim title-parallax" id="title-houses">
|
||||||
@@ -136,3 +135,4 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
|
</Transition>
|
||||||
@@ -29,8 +29,7 @@
|
|||||||
locations,
|
locations,
|
||||||
currentLocation,
|
currentLocation,
|
||||||
currentPhotos,
|
currentPhotos,
|
||||||
pageReady,
|
pageReady
|
||||||
pageTransition
|
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
import { formatDate, relativeTime, getThumbnail } from 'utils/functions'
|
import { formatDate, relativeTime, getThumbnail } from 'utils/functions'
|
||||||
|
|
||||||
@@ -47,10 +46,10 @@
|
|||||||
import Pagination from 'organisms/Pagination'
|
import Pagination from 'organisms/Pagination'
|
||||||
import Footer from 'organisms/Footer'
|
import Footer from 'organisms/Footer'
|
||||||
import SocialMetas from 'utils/SocialMetas'
|
import SocialMetas from 'utils/SocialMetas'
|
||||||
|
import Transition from 'utils/Transition'
|
||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
import { animateIn } from 'animations/place'
|
import { animateIn } from 'animations/place'
|
||||||
pageTransition.onAnimationEnd = animateIn
|
|
||||||
|
|
||||||
// Props and variables
|
// Props and variables
|
||||||
export let photos
|
export let photos
|
||||||
@@ -108,7 +107,7 @@
|
|||||||
/>
|
/>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
<Transition {animateIn}>
|
||||||
<section class="place">
|
<section class="place">
|
||||||
<div class="place__title">
|
<div class="place__title">
|
||||||
<h1 class="title-location title-location--big" aria-label="Houses of {location.name}">
|
<h1 class="title-location title-location--big" aria-label="Houses of {location.name}">
|
||||||
@@ -121,7 +120,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<a href="/choose" class="button-control button-control--big button-control--dashed" aria-label="Change the location" sapper-noscroll>
|
<a href="/choose" class="button-control button-control--big button-control--dashed" aria-label="Change the location">
|
||||||
<span class="center">
|
<span class="center">
|
||||||
<IconGlobe width="44" color="#fff" />
|
<IconGlobe width="44" color="#fff" />
|
||||||
<span>Change</span>
|
<span>Change</span>
|
||||||
@@ -140,7 +139,7 @@
|
|||||||
{#if description}
|
{#if description}
|
||||||
<p>
|
<p>
|
||||||
Houses Of
|
Houses Of
|
||||||
<LinkChange href="/choose" text={location.name} noScroll="true">
|
<LinkChange href="/choose" text={location.name}>
|
||||||
<IconGlobeSmall width="14" color="#999" />
|
<IconGlobeSmall width="14" color="#999" />
|
||||||
</LinkChange>
|
</LinkChange>
|
||||||
{description}
|
{description}
|
||||||
@@ -204,3 +203,4 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
|
</Transition>
|
||||||
|
|||||||
@@ -35,8 +35,7 @@
|
|||||||
locations,
|
locations,
|
||||||
currentLocation,
|
currentLocation,
|
||||||
currentPhotos,
|
currentPhotos,
|
||||||
pageReady,
|
pageReady
|
||||||
pageTransition
|
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
import { getThumbnail } from 'utils/functions'
|
import { getThumbnail } from 'utils/functions'
|
||||||
|
|
||||||
@@ -45,11 +44,11 @@
|
|||||||
import IconCross from 'atoms/IconCross'
|
import IconCross from 'atoms/IconCross'
|
||||||
import Carousel from 'organisms/Carousel'
|
import Carousel from 'organisms/Carousel'
|
||||||
import Fullscreen from 'organisms/Fullscreen'
|
import Fullscreen from 'organisms/Fullscreen'
|
||||||
|
import Transition from 'utils/Transition'
|
||||||
import SocialMetas from 'utils/SocialMetas'
|
import SocialMetas from 'utils/SocialMetas'
|
||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
import { animateIn } from 'animations/viewer'
|
import { animateIn } from 'animations/viewer'
|
||||||
pageTransition.onAnimationEnd = animateIn
|
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
export let photos
|
export let photos
|
||||||
@@ -100,6 +99,7 @@
|
|||||||
|
|
||||||
<svelte:window bind:innerWidth={windowWidth} />
|
<svelte:window bind:innerWidth={windowWidth} />
|
||||||
|
|
||||||
|
<Transition {animateIn}>
|
||||||
<section class="viewer">
|
<section class="viewer">
|
||||||
<div class="viewer__top">
|
<div class="viewer__top">
|
||||||
<p class="tip">Tap for fullscreen</p>
|
<p class="tip">Tap for fullscreen</p>
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
<IconCross color="#fff" width="18" class="icon" hidden="true" />
|
<IconCross color="#fff" width="18" class="icon" hidden="true" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="/" bind:this={gotoLink} aria-hidden="true" hidden class="hidden" sapper-noscroll> </a>
|
<a href="/" bind:this={gotoLink} aria-hidden="true" hidden class="hidden"> </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Carousel
|
<Carousel
|
||||||
@@ -127,3 +127,4 @@
|
|||||||
|
|
||||||
<Fullscreen />
|
<Fullscreen />
|
||||||
</section>
|
</section>
|
||||||
|
</Transition>
|
||||||
|
|||||||
@@ -141,17 +141,22 @@ button {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
@include breakpoint (sm) {
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
em {
|
em {
|
||||||
margin: 8px 0 4px;
|
margin: 8px 0 4px;
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
margin: 2px 16px 0 24px;
|
margin: 2px 16px 0 24px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
span {
|
||||||
flex-direction: row;
|
position: relative;
|
||||||
align-items: baseline;
|
display: inline-block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
// Main page
|
// Main page
|
||||||
.housesof {
|
.housesof {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
transition: opacity 0.4s $ease-quart;
|
transition: opacity 0.4s $ease-quart;
|
||||||
will-change: opacity;
|
will-change: opacity;
|
||||||
|
|
||||||
|
&.is-transitioning {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,78 +1,54 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { onMount } from 'svelte'
|
||||||
|
import { fly, fade } from 'svelte/transition'
|
||||||
|
import { quartInOut, quartOut } from 'svelte/easing'
|
||||||
import { stores } from '@sapper/app'
|
import { stores } from '@sapper/app'
|
||||||
import {
|
import { pageReady, firstLoad } from 'utils/store'
|
||||||
pageReady,
|
|
||||||
pageTransition,
|
|
||||||
transitionLong,
|
|
||||||
transitionPanelIn,
|
|
||||||
transitionDelay
|
|
||||||
} from './store'
|
|
||||||
const { page } = stores()
|
const { page } = stores()
|
||||||
|
|
||||||
|
// Animations
|
||||||
|
import { panelBackgroundOut } from 'animations/Transition'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import TitleSite from 'atoms/TitleSite'
|
import TitleSite from 'atoms/TitleSite'
|
||||||
import IconGlobe from 'atoms/IconGlobe'
|
import IconGlobe from 'atoms/IconGlobe'
|
||||||
|
|
||||||
// Animations
|
// Props and Variables
|
||||||
import { animateIn, animateOut } from 'animations/Transition'
|
export let animateIn = scope => {}
|
||||||
|
|
||||||
|
|
||||||
// Check if path is excluded
|
|
||||||
const isExcluded = path => path.includes(['/viewer/'])
|
|
||||||
|
|
||||||
/*
|
|
||||||
** PAGE LOADING PROCESS
|
|
||||||
** 1. Set pageReady to false
|
|
||||||
** 1. Runs the Loader transition In
|
|
||||||
** ?. The next page changes the value of pageReady when mounted (or later)
|
|
||||||
** 2. The Loader detects the value change of pageReady
|
|
||||||
** 3. Hide the loader with transition Out
|
|
||||||
** 4. The Loader runs the page transition In via pageTransition
|
|
||||||
*/
|
|
||||||
let scope
|
let scope
|
||||||
let firstLoad = true
|
let show = false
|
||||||
let previousPage = ''
|
|
||||||
|
|
||||||
// 1. Watch page change
|
|
||||||
page.subscribe(page => {
|
|
||||||
// Run transition if page is not excluded
|
|
||||||
if (!isExcluded(previousPage) || !isExcluded(page.path)) {
|
|
||||||
// Run the loader animation (first load only)
|
|
||||||
if (!firstLoad) {
|
|
||||||
animateIn(scope)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset pageReady when changing page
|
// Listen for when a route is mounted
|
||||||
pageReady.set(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update page for viewer navigation checking
|
|
||||||
previousPage = page.path
|
|
||||||
})
|
|
||||||
|
|
||||||
// 2. Watch when loaded changes
|
|
||||||
pageReady.subscribe(loaded => {
|
pageReady.subscribe(loaded => {
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
// 3. Hide the loader and set firstLoad to false (in order to show the second icon afterwards)
|
setTimeout(() => {
|
||||||
animateOut(scope, () => firstLoad = false)
|
show = true
|
||||||
|
firstLoad.set(false)
|
||||||
// Scroll back to top of page
|
setTimeout(() => animateIn(scope), 1)
|
||||||
setTimeout(() => window.scrollTo(0,0), transitionDelay)
|
}, 1000)
|
||||||
|
|
||||||
// 4. Run page entering animation
|
|
||||||
pageTransition.onAnimationEnd()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="transition" id="transition" aria-hidden="true" bind:this={scope}>
|
{#if show || !process.browser}
|
||||||
<div class="transition__loader">
|
<slot></slot>
|
||||||
{#if firstLoad}
|
|
||||||
<TitleSite init="true" />
|
|
||||||
|
|
||||||
|
{:else}
|
||||||
|
<div class="transition" id="transition" aria-hidden="true" bind:this={scope}>
|
||||||
|
<div class="transition__loader"
|
||||||
|
in:fly={{ y: 24, duration: 800, easing: quartOut }}
|
||||||
|
out:fly={{ y: -window.innerHeight/2, duration: 1400, easing: quartInOut }}
|
||||||
|
>
|
||||||
|
{#if $firstLoad}
|
||||||
|
<TitleSite />
|
||||||
{:else}
|
{:else}
|
||||||
<IconGlobe width="44" color="#fff" animated="true" />
|
<IconGlobe width="44" color="#fff" animated="true" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="transition__background" />
|
<div class="transition__background"
|
||||||
|
in:fade={{ duration: 600, easing: quartInOut }}
|
||||||
|
out:panelBackgroundOut={{ duration: 1400 }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// Svelte
|
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
// Define environment
|
// Define environment
|
||||||
@@ -25,17 +24,14 @@ export let currentLocation = writable()
|
|||||||
export let currentPhotos = writable()
|
export let currentPhotos = writable()
|
||||||
|
|
||||||
// State
|
// State
|
||||||
export let pageReady = writable(false)
|
export let pageReady = writable(false, () => {})
|
||||||
export const pageTransition = {
|
export let firstLoad = writable(true)
|
||||||
onAnimationEnd () {}
|
|
||||||
}
|
|
||||||
export let fullscreen = writable()
|
export let fullscreen = writable()
|
||||||
|
|
||||||
|
|
||||||
/* ==========================================================================
|
/* ==========================================================================
|
||||||
Animation related
|
Animation related
|
||||||
========================================================================== */
|
========================================================================== */
|
||||||
export const transitionDelay = 1400
|
export const animDelay = 800
|
||||||
export const transitionNormal = 1400
|
export const animDuration = 1400
|
||||||
export const transitionLong = 1800
|
export const animDurationLong = 1800
|
||||||
export const transitionPanelIn = 700
|
|
||||||
|
|||||||
Reference in New Issue
Block a user