Files
housesof/src/animations/TitleSite.js
Félix Péault 462359fcf2
All checks were successful
continuous-integration/drone/push Build is passing
Page and components animations rework WIP
2020-04-03 23:03:00 +02:00

28 lines
557 B
JavaScript

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