Code clean,

This commit is contained in:
2020-04-06 12:21:47 +02:00
parent 60fdf02112
commit 8fabe68241
7 changed files with 55 additions and 60 deletions

View File

@@ -7,21 +7,20 @@ import { animDelay } from 'utils/store'
** Transition In
*/
export const animateIn = (scope, init) => {
const tl = anime.timeline({
easing: 'easeOutQuart',
duration: 1000
})
// Stagger each letters and words
tl.add({
const letters = anime({
targets: scope.querySelectorAll('span, em span'),
translateY: ['100%', 0],
easing: 'easeOutQuart',
duration: 1000,
delay: anime.stagger(40, { start: init ? 0 : animDelay }),
autoplay: false
})
// On scroll animation
const title = ScrollOut({
once: true,
targets: scope,
onShown: () => tl.restart()
onShown: () => letters.restart()
})
}

View File

@@ -36,8 +36,8 @@ export const animateIn = () => {
duration: animDuration,
autoplay: false
})
window.addEventListener('scroll', throttle(() => parallaxAnime(document.getElementById('title-houses'), translate), 10))
requestAnimationFrame(() => parallaxAnime(document.getElementById('title-houses'), translate), 50)
window.addEventListener('scroll', throttle(() => parallaxAnime(document.getElementById('title-houses'), translate), 5))
requestAnimationFrame(() => parallaxAnime(document.getElementById('title-houses'), translate))
// Intro: Description
const introDescription = anime({