Optimize animations and transitions

will-change is apparently not enough to run GPU-enabled animations, use translateZ on top of it
This commit is contained in:
2020-04-09 20:23:24 +02:00
parent 7a44d5b0ed
commit be0f4c8b59
16 changed files with 75 additions and 43 deletions

View File

@@ -8,13 +8,24 @@ import { animDuration, animDelay } from 'utils/store'
export const animateIn = () => {
const tl = anime.timeline({
easing: 'easeOutQuart',
duration: animDuration
duration: animDuration,
delay: animDelay
})
// Simple slide and fade on each part of the page
tl.add({
targets: document.querySelectorAll('.page__part'),
opacity: [0, 1],
translateY: [8, 0],
delay: anime.stagger(160, { start: animDelay })
translateZ: [0, 0],
delay: anime.stagger(160)
})
// Globe
tl.add({
targets: document.querySelector('.globe'),
opacity: [0, 1],
translateY: ['5%', 0],
translateZ: [0, 0]
}, 200)
}