Last little fixes and debugging
This commit is contained in:
@@ -10,7 +10,6 @@ export const animateIn = scope => {
|
|||||||
const tl = anime.timeline({
|
const tl = anime.timeline({
|
||||||
easing: 'easeOutQuart',
|
easing: 'easeOutQuart',
|
||||||
duration: animDuration,
|
duration: animDuration,
|
||||||
// delay: animDelay,
|
|
||||||
autoplay: false
|
autoplay: false
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -27,7 +26,8 @@ export const animateIn = scope => {
|
|||||||
tl.add({
|
tl.add({
|
||||||
targets: scope.querySelector('.is-active picture'),
|
targets: scope.querySelector('.is-active picture'),
|
||||||
translateY: [8, 0],
|
translateY: [8, 0],
|
||||||
translateZ: [0, 0]
|
translateZ: [0, 0],
|
||||||
|
complete: event => event.animatables[0].target.removeAttribute('style')
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
// Photo: Prev
|
// Photo: Prev
|
||||||
@@ -36,7 +36,8 @@ export const animateIn = scope => {
|
|||||||
translateY: [8, 0],
|
translateY: [8, 0],
|
||||||
translateX: [64, 0],
|
translateX: [64, 0],
|
||||||
translateZ: [0, 0],
|
translateZ: [0, 0],
|
||||||
rotate: window.innerWidth >= 768 ? [-2, 0] : [0, 0]
|
rotate: window.innerWidth >= 768 ? [-2, 0] : [0, 0],
|
||||||
|
complete: event => event.animatables[0].target.removeAttribute('style')
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
// Photo: Next
|
// Photo: Next
|
||||||
@@ -45,13 +46,31 @@ export const animateIn = scope => {
|
|||||||
translateY: [8, 0],
|
translateY: [8, 0],
|
||||||
translateX: [-48, 0],
|
translateX: [-48, 0],
|
||||||
translateZ: [0, 0],
|
translateZ: [0, 0],
|
||||||
rotate: window.innerWidth >= 768 ? [2, 0] : [0, 0]
|
rotate: window.innerWidth >= 768 ? [2, 0] : [0, 0],
|
||||||
|
complete: event => event.animatables[0].target.removeAttribute('style')
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
// Reveal on scroll
|
// Reveal on scroll
|
||||||
const carouselIn = ScrollOut({
|
let visible = false
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
const carouselReveal = ScrollOut({
|
||||||
once: true,
|
once: true,
|
||||||
targets: scope,
|
targets: scope,
|
||||||
onShown: () => tl.restart()
|
onChange: (el, ctx) => {
|
||||||
|
if (ctx.visible === 0) {
|
||||||
|
visible = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShown: (el, ctx) => {
|
||||||
|
// If revealed on scroll, no delay
|
||||||
|
if (visible) {
|
||||||
|
tl.restart()
|
||||||
|
}
|
||||||
|
// If revealed on load, add a delay
|
||||||
|
else {
|
||||||
|
setTimeout(() => tl.restart(), animDelay * 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -7,18 +7,11 @@ import { animDuration, animDelay } from 'utils/store'
|
|||||||
*/
|
*/
|
||||||
export const animateIn = () => {
|
export const animateIn = () => {
|
||||||
const viewer = document.querySelector('.viewer')
|
const viewer = document.querySelector('.viewer')
|
||||||
|
|
||||||
const tl = anime.timeline({
|
const tl = anime.timeline({
|
||||||
easing: 'easeOutQuart',
|
easing: 'easeOutQuart',
|
||||||
duration: animDuration,
|
duration: animDuration,
|
||||||
delay: animDelay
|
delay: 1400
|
||||||
})
|
|
||||||
|
|
||||||
// Carousel
|
|
||||||
tl.add({
|
|
||||||
targets: viewer.querySelector('.carousel .wrap'),
|
|
||||||
opacity: [0, 1],
|
|
||||||
translateY: ['-4%', 0],
|
|
||||||
translateZ: [0, 0]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Carousel: Number
|
// Carousel: Number
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="title-location title-location--inline"
|
<div class="title-location title-location--inline" role="heading" aria-level="1"
|
||||||
bind:this={scope}
|
bind:this={scope}
|
||||||
style="opacity: {mounted ? 1 : 0}"
|
style="opacity: {mounted ? 1 : 0}"
|
||||||
>
|
>
|
||||||
<div role="heading" aria-level="1" aria-label="Houses">
|
<div aria-label="Houses">
|
||||||
<div class="anim-mask">
|
<div class="anim-mask">
|
||||||
{@html charsToSpan('Houses')}
|
{@html charsToSpan('Houses')}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -135,8 +135,7 @@
|
|||||||
|
|
||||||
<svelte:window on:keydown={keyboardNav} />
|
<svelte:window on:keydown={keyboardNav} />
|
||||||
|
|
||||||
<div class="carousel" role="region" aria-label="Photos"
|
<div class="carousel" role="region" aria-label="Photos" bind:this={scope}
|
||||||
bind:this={scope}
|
|
||||||
on:swipe={event => swipe(event.detail.directions)}
|
on:swipe={event => swipe(event.detail.directions)}
|
||||||
>
|
>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
name
|
name
|
||||||
slug
|
slug
|
||||||
flag { full_url title }
|
flag { full_url title }
|
||||||
continent { id }
|
continent { id name }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
locations (filter: { status_eq: "published" }) {
|
locations (filter: { status_eq: "published" }) {
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
name
|
name
|
||||||
slug
|
slug
|
||||||
region
|
region
|
||||||
country { id }
|
country { id name slug }
|
||||||
description
|
description
|
||||||
close
|
close
|
||||||
coordinates
|
coordinates
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
pageAnimation
|
pageAnimation
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
import { getThumbnail } from 'utils/functions'
|
import { getThumbnail } from 'utils/functions'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import IconGlobe from 'atoms/IconGlobe'
|
import IconGlobe from 'atoms/IconGlobe'
|
||||||
import IconCross from 'atoms/IconCross'
|
import IconCross from 'atoms/IconCross'
|
||||||
@@ -48,24 +47,24 @@
|
|||||||
import Fullscreen from 'organisms/Fullscreen'
|
import Fullscreen from 'organisms/Fullscreen'
|
||||||
import Transition from 'utils/Transition'
|
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'
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
export let photos
|
export let photos
|
||||||
|
|
||||||
// Variables
|
|
||||||
const { page } = stores()
|
const { page } = stores()
|
||||||
pageAnimation.set(animateIn)
|
pageAnimation.set(animateIn)
|
||||||
let windowWidth
|
|
||||||
let gotoLink
|
|
||||||
let currentPhoto = photos.find(photo => photo.slug === $page.params.photo)
|
|
||||||
let pageTitle = ($currentLocation) ? `Beautiful homes of ${$currentLocation.name}, ${$currentLocation.country.name}` : ''
|
|
||||||
|
|
||||||
// Update store current location
|
// Update store current location
|
||||||
if (!$currentLocation) currentLocation.set($locations.find(loc => loc.slug === $page.params.place))
|
currentLocation.set($locations.find(loc => loc.slug === $page.params.place))
|
||||||
if (!$currentPhotos) currentPhotos.set(photos)
|
currentPhotos.set(photos)
|
||||||
|
|
||||||
|
let windowWidth
|
||||||
|
let gotoLink
|
||||||
|
let pageTitle
|
||||||
|
let currentPhoto = photos.find(photo => photo.slug === $page.params.photo)
|
||||||
|
|
||||||
|
|
||||||
// Photo has changed (from Carousel)
|
// Photo has changed (from Carousel)
|
||||||
const photoChanged = event => {
|
const photoChanged = event => {
|
||||||
@@ -73,10 +72,10 @@
|
|||||||
const windowPathname = window.location.pathname
|
const windowPathname = window.location.pathname
|
||||||
const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug
|
const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug
|
||||||
// Go to page via a sapper-noscroll link to avoid scroll jump (hacky)
|
// Go to page via a sapper-noscroll link to avoid scroll jump (hacky)
|
||||||
|
if (gotoLink && newUrl) {
|
||||||
gotoLink.href = newUrl
|
gotoLink.href = newUrl
|
||||||
gotoLink.click()
|
gotoLink.click()
|
||||||
// Change page title with photo name
|
}
|
||||||
pageTitle = `${currentPhoto.name}, ${currentPhoto.location.country.name}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,11 +89,11 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{$site.seo_name} – {pageTitle}</title>
|
<title>{$site.seo_name} – Beautiful homes of {$currentLocation.name}, {$currentLocation.country.name}</title>
|
||||||
<meta name="description" content="{$site.seo_name} {$currentLocation.name} {$currentLocation.description}">
|
<meta name="description" content="{$site.seo_name} {$currentLocation.name} {$currentLocation.description}">
|
||||||
<SocialMetas
|
<SocialMetas
|
||||||
url="https://{$page.host}/viewer/{currentPhoto.location.country.slug}/{currentPhoto.location.slug}/{currentPhoto.slug}"
|
url="https://{$page.host}/viewer/{currentPhoto.location.country.slug}/{currentPhoto.location.slug}/{currentPhoto.slug}"
|
||||||
title="{$site.seo_name} - {pageTitle}"
|
title="{$site.seo_name} - Beautiful homes of {$currentLocation.name}, {$currentLocation.country.name}"
|
||||||
description="{$site.seo_name} {$currentLocation.name} {$currentLocation.description}"
|
description="{$site.seo_name} {$currentLocation.name} {$currentLocation.description}"
|
||||||
image={getThumbnail(currentPhoto.image.private_hash, 1200, 630)}
|
image={getThumbnail(currentPhoto.image.private_hash, 1200, 630)}
|
||||||
/>
|
/>
|
||||||
@@ -122,8 +121,7 @@
|
|||||||
<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" sapper-noscroll> </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Carousel {photos}
|
<Carousel {photos} viewer={true}
|
||||||
viewer="true"
|
|
||||||
on:photoChange={photoChanged}
|
on:photoChange={photoChanged}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
&, * {
|
&, * {
|
||||||
will-change: transform, opacity;
|
will-change: transform, opacity;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
// Specific box shadow for images
|
// Specific box shadow for images
|
||||||
&__photo {
|
&__photo {
|
||||||
box-shadow: 0 pxVW(16px) pxVW(40) rgba(#2E025C, 0.4);
|
box-shadow: 0 pxVW(16) pxVW(40) rgba(#2e025c, 0.4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,15 @@
|
|||||||
animDelay,
|
animDelay,
|
||||||
animPanelDelay
|
animPanelDelay
|
||||||
} from 'utils/store'
|
} from 'utils/store'
|
||||||
const { page } = stores()
|
|
||||||
$: animateIn = $pageAnimation
|
|
||||||
|
|
||||||
// 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
|
||||||
|
import { panelBackgroundOut } from 'animations/Transition'
|
||||||
|
|
||||||
// Props and Variables
|
// Variables
|
||||||
|
const { page } = stores()
|
||||||
|
$: animateIn = $pageAnimation
|
||||||
let scope
|
let scope
|
||||||
let show = false
|
let show = false
|
||||||
let firstLoad = true
|
let firstLoad = true
|
||||||
|
|||||||
Reference in New Issue
Block a user