Fix Intro?
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-06 22:33:47 +02:00
parent 380d155350
commit f414457172
5 changed files with 14 additions and 13 deletions

1
.env
View File

@@ -1,6 +1,5 @@
# Website # Website
PROD_URL="https://housesof.world" PROD_URL="https://housesof.world"
TRANSITION=true
HOME_PHOTOS_LIMIT=6 HOME_PHOTOS_LIMIT=6
# API # API

View File

@@ -10,7 +10,7 @@ export const animateIn = scope => {
// Each location (reveal on scroll) // Each location (reveal on scroll)
const locations = ScrollOut({ const locations = ScrollOut({
targets: scope.querySelectorAll('.location'), targets: scope.querySelectorAll('.location'),
onShown (el) { onShown: el => {
// Image // Image
anime({ anime({
targets: el.querySelector('img'), targets: el.querySelector('img'),

View File

@@ -4,11 +4,9 @@ import { quartOut } from 'svelte/easing'
// Crossfade transition // Crossfade transition
export const [send, receive] = crossfade({ export const [send, receive] = crossfade({
duration: d => Math.sqrt(d * 200), duration: d => Math.sqrt(d * 200),
fallback (node, params) { fallback (node, params) {
const style = getComputedStyle(node) const style = getComputedStyle(node)
const transform = style.transform === 'none' ? '' : style.transform const transform = style.transform === 'none' ? '' : style.transform
return { return {
duration: 600, duration: 600,
easing: quartOut, easing: quartOut,

View File

@@ -53,7 +53,7 @@ export const animateIn = () => {
const titleOf = ScrollOut({ const titleOf = ScrollOut({
once: true, once: true,
targets: '#title-of', targets: '#title-of',
onShown (el) { onShown: el => {
anime({ anime({
targets: el.querySelectorAll('span'), targets: el.querySelectorAll('span'),
translateY: ['100%', 0], translateY: ['100%', 0],
@@ -65,6 +65,7 @@ export const animateIn = () => {
}) })
// Title: World (reveal on scroll) // Title: World (reveal on scroll)
const titleWorld = document.getElementById('title-world')
const titleWorldTranslate = anime({ const titleWorldTranslate = anime({
targets: document.getElementById('title-world'), targets: document.getElementById('title-world'),
translateX: ['5%', '-3%'], translateX: ['5%', '-3%'],
@@ -72,10 +73,11 @@ export const animateIn = () => {
autoplay: false, autoplay: false,
duration: animDuration duration: animDuration
}) })
const titleWorld = ScrollOut({ const titleWorldAnime = parallaxAnime(titleWorld, titleWorldTranslate)
const titleWorldScroll = ScrollOut({
once: true, once: true,
targets: document.getElementById('title-world'), targets: titleWorld,
onShown (el) { onShown: () => {
const titleWorldLetters = anime({ const titleWorldLetters = anime({
targets: el.querySelectorAll('span'), targets: el.querySelectorAll('span'),
translateY: ['100%', 0], translateY: ['100%', 0],
@@ -83,9 +85,11 @@ export const animateIn = () => {
delay: anime.stagger(70), delay: anime.stagger(70),
duration: animDuration duration: animDuration
}) })
window.addEventListener('scroll', throttle(() => parallaxAnime(el, titleWorldTranslate), 10)) window.addEventListener('scroll', throttle(() => titleWorldAnime, 10))
requestAnimationFrame(() => parallaxAnime(el, titleWorldTranslate), 50) requestAnimationFrame(() => titleWorldAnime)
}, },
onHidden: () => window.removeEventListener('scroll', parallaxAnime) onHidden: () => {
if (parallaxAnime) window.removeEventListener('scroll', parallaxAnime)
}
}) })
} }

View File

@@ -37,7 +37,7 @@
{#if show || !process.browser} {#if show || !process.browser}
<slot /> <slot />
{:else if process.env.CONFIG.TRANSITION} {:else}
<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 }}