webdevRefinery Forum: Skippy laggy animations - webdevRefinery Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rate Topic: -----

User is offline iRook 

  • Group: Members
  • Posts: 300
  • Joined: 09-March 10
  • Expertise:Graphics

Posted 18 May 2012 - 06:42 PM (#1)

Skippy laggy animations


After a while..
I've noticed this. When I do jquery animations, they run perfectly smooth in Chrome for about..I have no idea. Maybe it is page reloads, maybe a certain amount of time. But once in a while, the animations are extremely laggy and stutter-y. The images move and look like they are chopped up (like the div is in a different place than the image by a few pixels), and every single animation on the page does this. They do not move slower, just choppy. An idea why?
..What do I do with all these cakes I baked?
0


User is online TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 18 May 2012 - 10:39 PM (#2)

You're doing too much processing? What is your processor? What else is going on in the JS?
Reserved.
0


User is offline iRook 

  • Group: Members
  • Posts: 300
  • Joined: 09-March 10
  • Expertise:Graphics

Posted 19 May 2012 - 10:43 AM (#3)

My processor is an AMD quad core. The JS is only doing the animation, the only other thing it does is set a window.location at the very end. And the animations only get choppy randomly, and as far as I can tell, only in chrome. (Speaking of stuff only in chrome, why does FF have such nice anti-aliased text?!)
..What do I do with all these cakes I baked?
0


User is offline alexdavey 

  • Bringing XKCD to a post near you
  • Group: Members
  • Posts: 848
  • Joined: 05-November 10
  • LocationLondon
  • Expertise:HTML,CSS,PHP,Javascript

Posted 19 May 2012 - 11:09 AM (#4)

View PostiRook, on 19 May 2012 - 10:43 AM, said:

My processor is an AMD quad core. The JS is only doing the animation, the only other thing it does is set a window.location at the very end. And the animations only get choppy randomly, and as far as I can tell, only in chrome. (Speaking of stuff only in chrome, why does FF have such nice anti-aliased text?!)


How many elements are you animating? If you post your code we should be able to help :)

If you are talking about text in canvas, Chrome doesn't support sub-pixel text rendering :(. It isn't clear in the specification, so some browsers do not support it, some browsers have it always on.
0


User is offline iRook 

  • Group: Members
  • Posts: 300
  • Joined: 09-March 10
  • Expertise:Graphics

Posted 19 May 2012 - 02:42 PM (#5)

See, I feel like the code wouldn't matter, because it happens on every single project I've done. But here it is.
$(document).ready(function(){
    var dl = 0;
   $("#container").delay(200).animate({top: "50px"}, 200)
				  .animate({top: "44px"}, 200)
				  .animate({top: "50px"}, 150)
				  .animate({top: "47px"}, 130)
				  .animate({top: "50px"},120)
	
   $("#logo").delay(1000).animate({width:"276px"}, 3000)
	
	$("#download_text").hover(
	function() {
	if(dl==0) {
		$("#download").stop().animate({bottom: "50px"});
		$(this).stop().fadeTo(200, 0);
		}
		
	}, 
	function() {
	
	$(this).stop().fadeTo(200, 1);
	});
	
	

	if(dl==0){
	$("#download").click(function() {
		window.location = "launcher_v1.zip";
			dl = 1;
		$("#download_text").html("Should have started!");
		$("#download").stop().animate({bottom: "-200px"});
	
		
		
		
		
	});
	}
	
                       

	
	$("li").hover(
	function() {
		$(this).stop().animate({left: "10px"});
	
	}, 
	function() {
	$(this).stop().animate({left: "0px"});
	});

});




Don't worry about my crappy ah..logic with the dl==0.
Edit: Just want to stress, this happens rarely.
..What do I do with all these cakes I baked?
0


User is offline Nand 

  • Group: Members
  • Posts: 36
  • Joined: 24-February 12
  • Expertise:PHP,SQL

Posted 20 May 2012 - 12:56 AM (#6)

Without going through the code...
If you are using Chrome, there's a flag that allows hardware based acceleration for canvas objects.

chrome://flags/

It's called: GPU-Accelerated SVG and CSS Filters
0


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users


Enter your sign in name and password


Sign in options
  Or sign in with these services