[Sugar-devel] What should be the ideal range for animations FPS ?

Manuel Quiñones manuq at laptop.org
Tue Jan 7 19:21:25 EST 2014


2014/1/7 Daniel Narvaez <dwnarvaez at gmail.com>:
> I'm not an expert of graphics performance or web technologies, but my
> understanding is that you don't want to be the one setting the FPS. The
> system will know much better when it's time to draw.
>
> And that seems the philosophy behind this API
>
> https://developer.mozilla.org/en/docs/Web/API/window.requestAnimationFrame
> https://hacks.mozilla.org/2011/08/animating-with-javascript-from-setinterval-to-requestanimationframe/

Yes, requestAnimationFrame is the preferred way to do it in JS.  To
reach a constant speed in your animations you can use Date.now()
inside the callback.  Further, you can use a tweener lib like TweenJS.

For browser compatibility you should use a polyfill like this one:
https://gist.github.com/paulirish/1579671

I have to add that to Clock Web.

-- 
.. manuq ..


More information about the Sugar-devel mailing list