WIP attempt to fix page transitions, Several edits
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user