Hi everyone,
I'm trying to use the animations on this demo for my website. But i've noticed a little bug, on desktop everything works perfectly, but on mobile
doesn't seem to be working properly. On mobile animations play smoothly when they are shown for the first time on the page,
but onEnterBack:() animations doesn't seem to be hidden, and they are replayed as they come back to view again, causing a glitchy, flashing effect. I wasn't sure if the problem was in my code, or the browsers I've tested on. So i went on to https://greensock.com/gsap/ on my mobile device which is using a very similar animation, and the same thing appears on the website as well.
I've managed the reveal from left, and right effect without a problem using:
gsap.registerPlugin(ScrollTrigger);
let imagesLeft = gsap.utils.toArray('.fromLeft');
imagesLeft.forEach((item, index) => {
let timeLine = gsap.timeline({
scrollTrigger:{
trigger: item,
toggleActions: "play reverse play reverse"
}
});
timeLine.from(item, {
x: -100,
opacity: 0,
duration: 1
});
});
let imagesRight = gsap.utils.toArray('.fromRight');
imagesRight.forEach((item, index) => {
let timeLine = gsap.timeline({
scrollTrigger:{
trigger: item,
toggleActions: "play reverse play reverse"
}
});
timeLine.from(item, {
x: 100,
opacity: 0,
duration: 1
});
});
which works perfectly on mobile as well. But i couldn't achieve the effect used on the texts, and the headers where they appear depending on the scroll direction.
I was hoping if someone could help me out solving this problem so the text, and header animations work properly on mobile devices?
Thank you.