diff --git a/src/animations.js b/src/animations.js index dcc629e..a61dfec 100644 --- a/src/animations.js +++ b/src/animations.js @@ -1,2 +1,23 @@ // import anime from 'animejs' +import { crossfade } from 'svelte/transition' +import { quartOut } from 'svelte/easing' + +// Crossfade transition +export const [crossfadeSend, crossfadeReceive] = crossfade({ + duration: d => Math.sqrt(d * 200), + + fallback(node, params) { + const style = getComputedStyle(node) + const transform = style.transform === 'none' ? '' : style.transform + + return { + duration: 600, + easing: quartOut, + css: t => ` + transform: ${transform} scale(${t}); + opacity: ${t} + ` + } + } +}) diff --git a/src/molecules/Location.svelte b/src/molecules/Location.svelte index 87f2aca..c4ad539 100644 --- a/src/molecules/Location.svelte +++ b/src/molecules/Location.svelte @@ -1,15 +1,16 @@ -
- - {'Flag -

{name}

-

{country.name}

+
+ + Flag of {location.country.name} +
+

{location.name}

+
+
+

{location.country.name}

+
diff --git a/src/organisms/Locations.svelte b/src/organisms/Locations.svelte index baad200..da3cf7f 100644 --- a/src/organisms/Locations.svelte +++ b/src/organisms/Locations.svelte @@ -1,15 +1,20 @@ @@ -56,29 +54,23 @@
{#each filteredLocations as location (location.id)} -
- - +
{/each}
diff --git a/src/style/_animations.scss b/src/style/_animations.scss index 57c9672..b76a630 100644 --- a/src/style/_animations.scss +++ b/src/style/_animations.scss @@ -101,6 +101,40 @@ } +// Location reveal +[data-aos="location"] { + img { + opacity: 0; + transform: scale(1.15); + transition: opacity 0.6s $ease-quart, transform 0.6s $ease-quart; + will-change: opacity, transform; + } + + h3, p { + transform: translateY(150%); + transition: transform 0.6s $ease-quart; + will-change: transform; + } + h3 { + transition: all 0.6s $ease-quart; + transition-delay: 100ms; + } + p { + transition-delay: 200ms; + } + + &.aos-animate { + img { + opacity: 1; + transform: scale(1); + } + h3, p { + transform: translateY(0); + } + } +} + + /* ========================================================================== KEYFRAMES ANIMATIONS diff --git a/src/style/organisms/_locations.scss b/src/style/organisms/_locations.scss index 88a8728..a349248 100644 --- a/src/style/organisms/_locations.scss +++ b/src/style/organisms/_locations.scss @@ -37,12 +37,13 @@ // Locations &__locations { + min-height: 200px; margin-top: 112px; @include breakpoint (sm) { display: flex; // display: grid; - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + // grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-column-gap: 120px; grid-row-gap: pxVW(120); justify-content: center; @@ -59,7 +60,12 @@ margin-bottom: 48px; @include breakpoint (sm) { - margin-bottom: 0; + margin-left: pxVW(72); + margin-right: pxVW(72); + } + @include breakpoint (xl) { + margin-left: 72px; + margin-right: 72px; } a { @@ -82,17 +88,26 @@ // City &__city { - margin: 24px 0 16px; font-family: $font-serif; font-size: rem(32px); color: $color-secondary; - transition: color 85ms ease-in-out; @include breakpoint (sm) { font-size: rem(48px); + } + } + .mask-city { + height: 40px; + margin: 24px 0 16px; + + @include breakpoint (sm) { + height: 64px; margin-bottom: 24px; } } + .mask-country { + height: 16px; + } // Shape on hover &:after {