Jump to content
Search Community

Choppy Animation in Carousel

kkranzo test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

So, here is another question about the smoothness of animations and how I can get them to be smoother. I have a carousel that has 5 "slides" in it and 5 external buttons that move a slide into view (the div is 940 x 357) upon rollover/hover. This works great when you just slowly rollover the buttons in a slow fashion. But if you hover over them fairly quickly things start to get choppy and some glitches happen. It sometimes even happens every so often when you go slow (you'll rollover a button and it will just show the slide rather than animating it in). I was thinking maybe there were some overwrite issues going on, but I tried all the different overwrite settings and it didn't help. Can you see why that would be from my code snippet below?

 

previousSlide = document.getElementById("slide" + activeSlide);
showSlide = document.getElementById("slide" + slideNumber);
previousSlide.style.zIndex = 7778;
showSlide.style.zIndex = 7779;
if (activeSlide < slideNumber) {
	    showSlide.style.visibility = "visible";
	    TweenMax.to(previousSlide, .5, {css:{left:"-940px"}, ease:Circ.easeOut, onComplete:hidePrevious});
	    showSlide.style.left = "940px";
	    TweenMax.to(showSlide, .5, {css:{left:"0px"}, ease:Circ.easeOut});
} else if (activeSlide > slideNumber) {
	    showSlide.style.visibility = "visible";
	    TweenMax.to(previousSlide, .5, {css:{left:"940px"}, ease:Circ.easeOut, onComplete:hidePrevious});
	    showSlide.style.left = "-940px";
	    TweenMax.to(showSlide, .5, {css:{left:"0px"}, ease:Circ.easeOut});
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...