WIP attempt to fix page transitions, Several edits
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-02 16:07:16 +02:00
parent 6f409c5331
commit 730eb75457
34 changed files with 386 additions and 401 deletions

View File

@@ -163,15 +163,17 @@ export const relativeTime = (originDate, limit = 0) => {
** Controls Anime.js parallax
*/
export const parallaxAnime = (element, anime) => {
const bound = element.getBoundingClientRect()
const windowHeight = window.innerHeight
if (bound.top < windowHeight && bound.bottom > 0) {
anime.seek(anime.duration * ((windowHeight - bound.top) / (windowHeight + bound.height)).toFixed(3))
} else {
if (bound.top >= windowHeight) {
anime.seek(0)
} else if (bound.bottom <= 0) {
anime.seek(anime.duration)
if (element) {
const bound = element.getBoundingClientRect()
const windowHeight = window.innerHeight
if (bound.top < windowHeight && bound.bottom > 0) {
anime.seek(anime.duration * ((windowHeight - bound.top) / (windowHeight + bound.height)).toFixed(3))
} else {
if (bound.top >= windowHeight) {
anime.seek(0)
} else if (bound.bottom <= 0) {
anime.seek(anime.duration)
}
}
}
}