Fix index animations
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-06 22:53:46 +02:00
parent f414457172
commit 1a05c35fc8
5 changed files with 48 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ export const animateIn = (scope, init) => {
translateY: ['100%', 0],
easing: 'easeOutQuart',
duration: 1000,
delay: anime.stagger(40),
delay: anime.stagger(40, { start: init ? 0 : animDelay }),
autoplay: false
})
@@ -21,12 +21,6 @@ export const animateIn = (scope, init) => {
const title = ScrollOut({
once: true,
targets: scope,
onShown: () => {
if (init) {
letters.restart()
} else {
setTimeout(() => letters.restart(), animDelay)
}
}
onShown: () => letters.restart()
})
}

View File

@@ -67,26 +67,26 @@ export const animateIn = () => {
// Title: World (reveal on scroll)
const titleWorld = document.getElementById('title-world')
const titleWorldTranslate = anime({
targets: document.getElementById('title-world'),
targets: titleWorld,
translateX: ['5%', '-3%'],
easing: 'linear',
autoplay: false,
duration: animDuration
})
const titleWorldAnime = parallaxAnime(titleWorld, titleWorldTranslate)
const titleWorldAnime = () => parallaxAnime(titleWorld, titleWorldTranslate)
const titleWorldScroll = ScrollOut({
once: true,
targets: titleWorld,
onShown: () => {
const titleWorldLetters = anime({
targets: el.querySelectorAll('span'),
targets: titleWorld.querySelectorAll('span'),
translateY: ['100%', 0],
easing: 'easeOutQuart',
delay: anime.stagger(70),
duration: animDuration
})
window.addEventListener('scroll', throttle(() => titleWorldAnime, 10))
requestAnimationFrame(() => titleWorldAnime)
window.addEventListener('scroll', throttle(titleWorldAnime, 10))
requestAnimationFrame(titleWorldAnime)
},
onHidden: () => {
if (parallaxAnime) window.removeEventListener('scroll', parallaxAnime)

View File

@@ -53,6 +53,7 @@
.photo {
position: relative;
z-index: 4;
overflow: hidden;
// Last photo doesn't need spacing
&:last-child {