Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 8, 2013 06:41 pm GMT

Using requestAnimationFrame

There used to be just one way to do a timed loop in JavaScript: setInterval(). If you needed to repeat something pretty fast (but not as-fast-as-absolutely-possible like a for loop), you'd use that. For the purposes of animation, the goal is sixty "frames" per second to appear smooth, so you'd run a loop like this:

setInterval(function() { // animiate something}, 1000/60);

There is a better alternative to this now. Paul Irish introduced requestAnimationFrame over two years ago. I …


Need a new look for your portfolio? Check out the Snap WordPress theme from The Theme Foundry. Sass files and Compass config are included!


Using requestAnimationFrame is a post from CSS-Tricks


Original Link: http://css-tricks.com/using-requestanimationframe/

Share this article:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks