Carousel: Fix reveal
This commit is contained in:
@@ -52,16 +52,18 @@ export const animateIn = scope => {
|
|||||||
|
|
||||||
// Reveal on scroll
|
// Reveal on scroll
|
||||||
let visible = false
|
let visible = false
|
||||||
requestAnimationFrame(() => {
|
|
||||||
const carouselReveal = ScrollOut({
|
const carouselReveal = ScrollOut({
|
||||||
once: true,
|
once: true,
|
||||||
targets: scope,
|
targets: scope,
|
||||||
onChange: (el, ctx) => {
|
onChange: (el, ctx) => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
if (ctx.visible === 0) {
|
if (ctx.visible === 0) {
|
||||||
visible = true
|
visible = true
|
||||||
}
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onShown: (el, ctx) => {
|
onShown: (el, ctx) => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
// If revealed on scroll, no delay
|
// If revealed on scroll, no delay
|
||||||
if (visible) {
|
if (visible) {
|
||||||
tl.restart()
|
tl.restart()
|
||||||
@@ -70,7 +72,7 @@ export const animateIn = scope => {
|
|||||||
else {
|
else {
|
||||||
setTimeout(() => tl.restart(), animDelay * 2)
|
setTimeout(() => tl.restart(), animDelay * 2)
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user