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

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


2014/1/7 James Cameron <quozl at laptop.org>:
> On Tue, Jan 07, 2014 at 05:37:34PM +0100, laurent bernabe wrote:
>> As I am programming on a recent laptop, it can be easy to call
>> javascript method  setTimeout with too high values, without noticing
>> the wrong behaviour for real XO.
>>
>> This is why I am wondering what should be the ideal range for
>> animations Frames Per Second value ?
>
> There is no easy answer.  There are too many factors.
>
> I can speak from experience with Pygame and attempt to explain how to
> transfer that experience to Javascript.
>
> Now, Pygame is a raster based animation, and Javascript drawing can be
> vector based.  I do not know if the layer between Javascript and the
> display handles this as vectors or a raster.  At worst, it will be a
> raster.
>
> A raster based animation must update the display by blitting changed
> rectangles.
>
> At worst, the entire drawing area must be blitted.
>
> At best, only a small rectangle covering the motion must be blitted.
> This is a rectangle that is the union of the old position of the
> object and the new position of the object.
>
> There is a sequence of steps between the application program and the
> hardware:
>
> - the application program makes drawing commands,
>
> - the application program asks for a frame to be revealed (Pygame's
>   display update), or the library assumes it (setTimeout),
>
> - the library translates the display update into the display protocol;
>   which for Pygame means the change is passed to SDL, which passes it
>   to X,
>
> - some time later, the X display server receives the change and
>   updates the frame buffer,
>
> - the light from the display reaches the user.  ;-)

Yes, that's the theory and is important to understand what happens
under the hood.  PyGame does a good job giving you the dirty rects  By
the way, usually you let that job to the lib in question.  There are
graphics libs for JS, some work with canvas and some with SVG.

-- 
.. manuq ..


More information about the Sugar-devel mailing list