I'm working on a website for a client and we've decided to use CSS3 instead of Flash for multiple reasons, compatibility with mobile devices being the main. However, there's a lot of animation on the page such as fading, positioning and opening/closing and it seems to be tripping over itself attempting to process everything.
I've created an animation class that schedules all of the animations so that there's only one setTimeout running for those animations at any given time. I've also set it up so that any web browser capable of CSS3 transitions use those instead of the JS animations. The animations lag in both CSS3 and JS functionality, although the CSS3 is slightly better.
Some animations lag even if they're the only animation running. For instance, trying to fade a full-screen image in/out chugs even on test pages I've created only containing the one function.
I understand that Flash uses hardware acceleration and has optimized rendering, and the reason the browser is lagging is most likely because it's all being processed unoptimized and through the CPU. However, I'm sure there must be a way to make this site smoother than it is.
I'm posting here because my deadline is coming hard and fast, to ask for assistance with:
- Tips on how to optimize my code to run smoother in JS and/or CSS3.
- Any info on how to be able to fade large images/areas with less lag
I've been trying to move most of my code into OOP as I've gone along, but some functions are still a bit "spaghetti" due to my time crunch. Sorry about that.
Thank you in advance for anybody kind enough to help me out.