[wip] Rework About page
This commit is contained in:
@@ -19,17 +19,14 @@
|
||||
import AboutGridPhoto from '$components/atoms/AboutGridPhoto.svelte'
|
||||
import Heading from '$components/molecules/Heading.svelte'
|
||||
import ProcessStep from '$components/molecules/ProcessStep.svelte'
|
||||
import InteractiveGlobe2 from '$components/organisms/InteractiveGlobe2.svelte'
|
||||
import ShopModule from '$components/organisms/ShopModule.svelte'
|
||||
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
||||
import Banner from '$components/organisms/Banner.svelte'
|
||||
|
||||
export let data: PageData
|
||||
const { about, photos } = data
|
||||
|
||||
let scrollY: number, innerWidth: number, innerHeight: number
|
||||
let purposeEl: HTMLElement, photosGridEl: HTMLElement
|
||||
let photosGridEl: HTMLElement
|
||||
let currentStep: number = 0
|
||||
let photoFirstEl: HTMLElement, photoUsEl: HTMLElement
|
||||
let photosGridOffset: number = photosGridEl && photosGridEl.offsetTop
|
||||
|
||||
$: currentStep = $page.url.hash ? Number($page.url.hash.split('#step-')[1]) - 1 : 0
|
||||
@@ -51,150 +48,62 @@
|
||||
/**
|
||||
* Animations
|
||||
*/
|
||||
const animation = timeline([
|
||||
// Heading
|
||||
['.heading .text', {
|
||||
y: [24, 0],
|
||||
opacity: [0, 1],
|
||||
z: 0,
|
||||
}, {
|
||||
at: 0.5,
|
||||
}],
|
||||
// const animation = timeline([
|
||||
// // Heading
|
||||
// ['.heading .text', {
|
||||
// y: [24, 0],
|
||||
// opacity: [0, 1],
|
||||
// z: 0,
|
||||
// }, {
|
||||
// at: 0.5,
|
||||
// }],
|
||||
|
||||
// First photo
|
||||
[photoFirstEl, {
|
||||
y: ['10%', 0],
|
||||
rotate: [0, getComputedStyle(photoFirstEl).getPropertyValue('--rotate')],
|
||||
opacity: [0, 1],
|
||||
z: 0,
|
||||
}, {
|
||||
at: 0.75,
|
||||
opacity: {
|
||||
duration: 1
|
||||
}
|
||||
}],
|
||||
// // First photo
|
||||
// [photoFirstEl, {
|
||||
// y: ['10%', 0],
|
||||
// rotate: [0, getComputedStyle(photoFirstEl).getPropertyValue('--rotate')],
|
||||
// opacity: [0, 1],
|
||||
// z: 0,
|
||||
// }, {
|
||||
// at: 0.75,
|
||||
// opacity: {
|
||||
// duration: 1
|
||||
// }
|
||||
// }],
|
||||
|
||||
// Portrait photo
|
||||
[photoUsEl, {
|
||||
y: ['10%', 0],
|
||||
x: [0, '5%'],
|
||||
rotate: [0, 5],
|
||||
opacity: [0, 1],
|
||||
z: 0,
|
||||
}, {
|
||||
at: 1,
|
||||
opacity: {
|
||||
duration: 1
|
||||
}
|
||||
}],
|
||||
// // Portrait photo
|
||||
// [photoUsEl, {
|
||||
// y: ['10%', 0],
|
||||
// x: [0, '5%'],
|
||||
// rotate: [0, 5],
|
||||
// opacity: [0, 1],
|
||||
// z: 0,
|
||||
// }, {
|
||||
// at: 1,
|
||||
// opacity: {
|
||||
// duration: 1
|
||||
// }
|
||||
// }],
|
||||
|
||||
// Text
|
||||
['.about__introduction .text', {
|
||||
y: [32, 0],
|
||||
opacity: [0, 1],
|
||||
z: 0,
|
||||
}, {
|
||||
at: 1.2,
|
||||
}],
|
||||
], {
|
||||
delay: $navigating ? DELAY.PAGE_LOADING / 1000 : 0,
|
||||
defaultOptions: {
|
||||
duration: 1.6,
|
||||
easing: quartOut,
|
||||
},
|
||||
})
|
||||
animation.stop()
|
||||
// // Text
|
||||
// ['.about__introduction .text', {
|
||||
// y: [32, 0],
|
||||
// opacity: [0, 1],
|
||||
// z: 0,
|
||||
// }, {
|
||||
// at: 1.2,
|
||||
// }],
|
||||
// ], {
|
||||
// delay: $navigating ? DELAY.PAGE_LOADING / 1000 : 0,
|
||||
// defaultOptions: {
|
||||
// duration: 1.6,
|
||||
// easing: quartOut,
|
||||
// },
|
||||
// })
|
||||
// animation.stop()
|
||||
|
||||
// Run animation
|
||||
requestAnimationFrame(animation.play)
|
||||
|
||||
|
||||
/**
|
||||
* Intro parallax
|
||||
*/
|
||||
// First photo
|
||||
scroll(animate(photoFirstEl.querySelector('figure'), {
|
||||
y: ['-3%', '6%'],
|
||||
x: [0, '-4%'],
|
||||
rotate: [-1.5, 0],
|
||||
z: 0,
|
||||
}), {
|
||||
target: photoFirstEl,
|
||||
offset: ["-200%", "150%"]
|
||||
})
|
||||
// Portrait photo
|
||||
scroll(animate(photoUsEl.querySelector('figure'), {
|
||||
y: [0, '-6%'],
|
||||
x: [0, '-3%'],
|
||||
rotate: [-2, 0],
|
||||
z: 0,
|
||||
}), {
|
||||
target: photoUsEl,
|
||||
offset: ["-250%", "150%"]
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Purpose reveal
|
||||
*/
|
||||
inView(purposeEl, ({ target, isIntersecting }) => {
|
||||
target.classList.toggle('is-visible', isIntersecting)
|
||||
}, { amount: 0.6 })
|
||||
|
||||
// Parallax
|
||||
scroll(animate(purposeEl.querySelector('picture img'), {
|
||||
y: [0, '40%'],
|
||||
}))
|
||||
|
||||
|
||||
/**
|
||||
* Steps scroll animation
|
||||
*/
|
||||
const cards = stepsEl.querySelectorAll('.step')
|
||||
const cardsAmount = about.process_steps.length
|
||||
|
||||
cards.forEach((card: HTMLElement, i: number) => {
|
||||
const index = i + 1
|
||||
const reverseIndex = cardsAmount - index
|
||||
const overlay = card.querySelector('.overlay')
|
||||
const scrollOptions: ScrollOptions = {
|
||||
target: stepsEl,
|
||||
offset: [`${i / cardsAmount * 100}%`, `${index / cardsAmount * 100}%`],
|
||||
}
|
||||
|
||||
// Card scale
|
||||
scroll(animate(card, {
|
||||
scale: [1, 1 - (0.02 * reverseIndex)]
|
||||
}), scrollOptions)
|
||||
|
||||
// Overlay opacity
|
||||
scroll(animate(overlay, {
|
||||
opacity: [0, 0.2 + (0.05 * reverseIndex)]
|
||||
}), scrollOptions)
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Play videos only when visible
|
||||
*/
|
||||
const videos = stepsEl.querySelectorAll('video')
|
||||
if (videos) {
|
||||
videosObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(({ target, isIntersecting }) => {
|
||||
// @ts-ignore
|
||||
isIntersecting ? target.play() : target.pause()
|
||||
})
|
||||
}, {
|
||||
threshold: 0,
|
||||
})
|
||||
videos.forEach(video => videosObserver.observe(video))
|
||||
}
|
||||
|
||||
|
||||
// Destroy
|
||||
return () => {
|
||||
videosObserver.disconnect()
|
||||
}
|
||||
// // Run animation
|
||||
// requestAnimationFrame(animation.play)
|
||||
})
|
||||
|
||||
|
||||
@@ -214,72 +123,51 @@
|
||||
|
||||
|
||||
<PageTransition name="about">
|
||||
<Heading
|
||||
text={about.description}
|
||||
<Banner
|
||||
title="About"
|
||||
image={{
|
||||
id: '699b4050-6bbf-4a40-be53-d84aca484f9d',
|
||||
alt: 'Photo caption',
|
||||
}}
|
||||
/>
|
||||
|
||||
<section class="about__introduction">
|
||||
<div class="container grid">
|
||||
<div class="photo-first" bind:this={photoFirstEl}>
|
||||
<figure>
|
||||
<Image
|
||||
class="shadow-box-dark"
|
||||
id={about.intro_firstphoto.id}
|
||||
alt={about.intro_firstphoto.title}
|
||||
sizeKey="photo-list"
|
||||
sizes={{
|
||||
small: { width: 400 },
|
||||
medium: { width: 600 },
|
||||
large: { width: 800 },
|
||||
}}
|
||||
ratio={1.5}
|
||||
/>
|
||||
<figcaption class="text-info">{about.intro_firstphoto_caption}</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
<h2 class="title-small">Meet the makers</h2>
|
||||
<p class="heading text-big">We are a French and Australian couple that found each other through our mutual <strong>passion for travel, photography and design</strong>.</p>
|
||||
|
||||
<div class="photo-us" bind:this={photoUsEl}>
|
||||
<figure>
|
||||
<Image
|
||||
class="shadow-box-dark"
|
||||
id={about.intro_portraits.id}
|
||||
alt={about.intro_portraits.title}
|
||||
sizeKey="square"
|
||||
sizes={{
|
||||
small: { width: 250 }
|
||||
}}
|
||||
ratio={1}
|
||||
/>
|
||||
</figure>
|
||||
</div>
|
||||
|
||||
<div class="text text-normal">
|
||||
{@html introText}
|
||||
<div class="text text-small">
|
||||
<p>With a strong desire to create, we’re award winning in our own fields with <a href="">Félix</a> as a Digital Designer and Art Director and <a href="">Shelby</a> as a Front-End Developer.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="about__purpose grid" bind:this={purposeEl}>
|
||||
<div class="container">
|
||||
<div class="text title-xl">
|
||||
{@html about.purpose_text}
|
||||
</div>
|
||||
|
||||
<div class="background">
|
||||
<picture class="background__illustration">
|
||||
<source media="(min-width: 1200px)" srcset={getAssetUrlKey(about.intro_firstlocation.illustration_desktop_2x.id, 'illustration-desktop-2x')}>
|
||||
<source media="(min-width: 768px)" srcset={getAssetUrlKey(about.intro_firstlocation.illustration_desktop.id, 'illustration-desktop-1x')}>
|
||||
<img
|
||||
src={getAssetUrlKey(about.intro_firstlocation.illustration_mobile.id, 'illustration-mobile')}
|
||||
width={320}
|
||||
height={824}
|
||||
alt="Illustration for {about.intro_firstlocation.name}"
|
||||
decoding="async"
|
||||
/>
|
||||
</picture>
|
||||
</div>
|
||||
<div class="about__creation">
|
||||
<div class="container grid">
|
||||
<figure class="first-photo">
|
||||
<Image
|
||||
class="shadow-box-dark"
|
||||
id={about.intro_firstphoto.id}
|
||||
alt={about.intro_firstphoto.title}
|
||||
sizeKey="photo-list"
|
||||
sizes={{
|
||||
small: { width: 400 },
|
||||
medium: { width: 600 },
|
||||
large: { width: 800 },
|
||||
}}
|
||||
ratio={1.5}
|
||||
/>
|
||||
<figcaption class="text-info">
|
||||
{about.intro_firstphoto_caption}<br>
|
||||
in
|
||||
<a href="/{about.intro_firstlocation.country.slug}/{about.intro_firstlocation.slug}" data-sveltekit-noscroll data-sveltekit-prefetch>
|
||||
<img src="{getAssetUrlKey(about.intro_firstlocation.country.flag.id, 'square-small-jpg')}" width="32" height="32" alt="{about.intro_firstlocation.country.flag.title}">
|
||||
<span>Naarm Australia (Melbourne)</span>
|
||||
</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="about__process">
|
||||
<div class="container grid">
|
||||
|
||||
Reference in New Issue
Block a user