Hi,
I'm new in gsap and need a little help. I have an animation that triggers on each scroll event and sometimes the animation stutters badly. The fps meter shows values from 9 to 55. (I'm trying to animate divs with png background).
Rough version of my code:
var scrollPosition = 0,
lastScrollTop = 0;
$(window).scroll(function(){
scrollPosition = $myWindow.scrollTop();
if (scrollPosition > lastScrollTop){
// --- scroll down
TweenLite.to($('.boxes'), 2.5, {top: "+=50px", force3D:true, ease:Quad.easeInOut}, 0.25);
} else {
// --- scroll up
TweenLite.to($('.boxes'), 2.5, {top: "-=50px", force3D:true, ease:Quad.easeInOut}, 0.25);
}
// --- update last scroll
lastScrollTop = scrollPosition;
});
Is there something that I could optimize, must I use timelines etc.?
Any help would be greatly appreciated
p.s. sorry for my bad English