Place: Add photo Transition In, Add Illustration system, Visual fixes

- Add a transition in on each photo component (scale down + fade in), TODO: Parallax on number
- Illustration takes two images and changes the source depending on the viewport size
This commit is contained in:
2020-03-10 21:25:48 +01:00
parent eb529b196e
commit debd9a41c1
6 changed files with 120 additions and 31 deletions

48
src/animations/Photo.js Normal file
View File

@@ -0,0 +1,48 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
import { animDuration, animDurationLong } from '../utils/store'
import { debounce } from '../utils/functions'
/*
** Transition In
*/
export const animateIn = scope => {
// Title appearing
const titleReveal = ScrollOut({
once: true,
targets: scope,
offset: window.offsetHeight / 3,
onShown (el) {
// Title reveal
anime({
targets: el.querySelectorAll('h2 span'),
translateY: ['100%', 0],
duration: 1000,
delay: anime.stagger(120),
easing: 'easeOutQuart'
})
}
})
// Photo appearing
const photoReveal = ScrollOut({
once: true,
targets: scope.querySelector('picture'),
offset: window.offsetHeight / 3,
onShown (el) {
// Title reveal
anime({
targets: el.querySelector('img'),
scale: [1.12, 1],
opacity: [0, 1],
duration: 2000,
delay: 50,
easing: 'easeOutQuart'
})
}
})
// Number parallax
//! TODO
}