diff --git a/apps/website/src/animations/transitions.ts b/apps/website/src/animations/transitions.ts index df45e23..a7ba82f 100644 --- a/apps/website/src/animations/transitions.ts +++ b/apps/website/src/animations/transitions.ts @@ -9,24 +9,25 @@ import { quartOut } from './easings' export const scaleFade = (node: HTMLElement, { scale = [0.7, 1], opacity = [1, 0], - x = null, + x = [0, 0], delay = 0, - duration = 1, + duration = 0.75, }): TransitionConfig => { - return { - css: () => { - animate(node, { - scale, - opacity, - x, - z: 0, - }, { - easing: quartOut, - duration, - delay, - }) + const anim = animate(node, { + scale, + opacity, + x, + z: 0, + }, { + easing: quartOut, + duration, + delay, + }) - return null + return { + duration: anim.duration * 1000, + tick: (t) => { + anim.currentTime = t } } } @@ -42,19 +43,20 @@ export const revealSplit = (node: HTMLElement, { duration = 1, delay = 0, }): TransitionConfig => { - return { - css: () => { - animate(node.querySelectorAll(children), { - opacity, - y, - z: 0, - }, { - easing: quartOut, - duration, - delay: stagger(0.04, { start: delay }), - }) + const anim = animate(node.querySelectorAll(children), { + opacity, + y, + z: 0, + }, { + easing: quartOut, + duration, + delay: stagger(0.04, { start: delay }), + }) - return null + return { + duration: anim.duration * 1000, + tick: (t) => { + anim.currentTime = t } } } diff --git a/apps/website/src/components/atoms/ScrollingTitle.svelte b/apps/website/src/components/atoms/ScrollingTitle.svelte index 31a5cf1..96668d2 100644 --- a/apps/website/src/components/atoms/ScrollingTitle.svelte +++ b/apps/website/src/components/atoms/ScrollingTitle.svelte @@ -35,7 +35,7 @@ let scrollY = $state() let innerWidth = $state() let innerHeight = $state() - let titleEl = $state() + let titleEl: HTMLElement // Check if title is larger than viewport to translate it const isLarger = $derived(titleEl && titleEl.offsetWidth >= innerWidth) diff --git a/apps/website/src/components/molecules/Location/Location.svelte b/apps/website/src/components/molecules/Location/Location.svelte index 0d994a3..d278b87 100644 --- a/apps/website/src/components/molecules/Location/Location.svelte +++ b/apps/website/src/components/molecules/Location/Location.svelte @@ -24,7 +24,7 @@ const { settings }: any = getContext('global') - let locationEl = $state() + let locationEl: HTMLElement let photoIndex = $state(0) // Location date limit diff --git a/apps/website/src/components/molecules/ProcessStep/ProcessStep.svelte b/apps/website/src/components/molecules/ProcessStep/ProcessStep.svelte index 2ca6951..41b1a4e 100644 --- a/apps/website/src/components/molecules/ProcessStep/ProcessStep.svelte +++ b/apps/website/src/components/molecules/ProcessStep/ProcessStep.svelte @@ -3,18 +3,18 @@ - - -
+

Houses @@ -269,7 +266,7 @@ {#if location?.hero?.id} - + () let innerWidth = $state() - let innerHeight = $state() - let photosGridEl = $state() - let photosGridOffset = $state() - let currentStep = $state(0) + let photosGridEl: HTMLElement + let photosGridParallax = $state() + let currentStepIndex = $state(0) + const currentStep = $derived(data.about.process_steps[currentStepIndex]) let emailCopied = $state() let emailCopiedTimeout: ReturnType | number - const parallaxPhotos = $derived(photosGridEl && map(scrollY, photosGridOffset - innerHeight, photosGridOffset + innerHeight / 1.5, 0, innerHeight * 0.15, true)) const fadedPhotosIndexes = $derived( innerWidth > 768 ? [0, 2, 5, 7, 9, 12, 17, 20, 22, 26, 30, 32, 34] @@ -41,9 +39,11 @@ $effect(() => { - // Update photos grid top offset - photosGridOffset = photosGridEl.offsetTop - + // Add parallax to photos grid + scroll(({ y }) => photosGridParallax = lerp(-15, 10, y.progress), { + target: photosGridEl, + offset: ['start end', 'end start'] + }) /** * Animations @@ -171,10 +171,10 @@ }) - + @@ -313,13 +313,13 @@
    {#each data.about.process_steps as { title }, index} -
  1. +
  2. { event.preventDefault() - currentStep = index + currentStepIndex = index sendEvent('aboutStepSwitch') }} > @@ -331,25 +331,23 @@
    - {#each data.about.process_steps as { text, image, video_mp4, video_webm }, index} - {#if index === currentStep} - - {/if} - {/each} + {#key currentStep} + + {/key}

-
+
{#each data.photos as { image: { id }, title }, index} { + oncopied={({ detail: email }: CustomEvent) => { emailCopied = email // Clear timeout and add timeout to hide message clearTimeout(emailCopiedTimeout) diff --git a/apps/website/src/style/pages/_about.scss b/apps/website/src/style/pages/_about.scss index 9fe6d8f..044dce3 100644 --- a/apps/website/src/style/pages/_about.scss +++ b/apps/website/src/style/pages/_about.scss @@ -492,7 +492,7 @@ grid-template-columns: repeat(5, 1fr); gap: 1.75vw; margin: -5% -5% 0; - transform: rotate(-6deg) translateY(var(--parallax-y)) translateZ(0); + transform: rotate(-6deg) translateY(var(--parallax)) translateZ(0); transition: transform 0.8s var(--ease-quart); @include bp (sm) { diff --git a/apps/website/src/style/pages/_location.scss b/apps/website/src/style/pages/_location.scss index 6ff005e..7e11be2 100644 --- a/apps/website/src/style/pages/_location.scss +++ b/apps/website/src/style/pages/_location.scss @@ -173,8 +173,8 @@ pointer-events: none; user-select: none; filter: grayscale(25%); - transform: translate3d(0, var(--parallax-y), 0); - transition: transform 0.7s var(--ease-quart); + transform: translateY(var(--parallax)) translateZ(0); + transition: transform 0.5s var(--ease-quart); will-change: transform, opacity; } } diff --git a/apps/website/src/utils/functions/index.ts b/apps/website/src/utils/functions/index.ts index c5f6f38..a7a564c 100644 --- a/apps/website/src/utils/functions/index.ts +++ b/apps/website/src/utils/functions/index.ts @@ -14,7 +14,7 @@ export const mailtoClipboard = (node: HTMLElement) => { navigator.clipboard.writeText(emailAddress) // Send event - node.dispatchEvent(new CustomEvent('copied', emailAddress)) + node.dispatchEvent(new CustomEvent('copied', { detail: emailAddress })) // Record event in analytics sendEvent('emailCopy')