Create your blog and photo album with postbit
Create your blog and photo album

Create new post


Upload a picture:
Tags (keywords separated by comma)

Save Cancel
The JavaScript Blog js:   Followers: 5 ; Following: 3

Explore The JavaScript Blog's photo albums:
Javascript tools (2)
Photos from posts (7)

requestAnimationFrame API

It's said that requestAnimationFrame is better than setTimeout, with better CPU Efficiency, lower power consumption, lower background interference and better callback management times.

Online performance comparison:

OLD METHOD (window.setTimeout):
function draw() {
var now = new Date().getTime();
updateModels(now - last);
last = now;
window.setTimeout(draw, 10);

NEW METHOD (requestAnimationFrame):
function draw(future) {

updateModels(future - last);
last = future;
requestAnimationFrame(draw, canvas);

Code from:

Warning - This is an experimental technology, check syntax for multiple browsers:

Post by The JavaScript Blog (2012-06-21 14:49)

Post your comment:

Name: Email: Site:

| Explore users | New posts | Create your blog | Create your photo album |
| About Postbit | Our blog | Terms of use | Contact Postbit |

Copyright © 2018 -