jframes
A light weight animation frame support. With the frame object, you are convinent to do some calculation.
The Frame Object
The frame object will pass in the jframes.request()
callback. It providers:
frame.time
time in javascript (eg.+new Date()
).frame.index
index of the requested frame sequence base on zero.frame.dur
the duration time from current frame to the last frame in ms.frame.elapsed
the elapsed time from the first frame to current frame in ms.frame.next()
tells jframes to execute the next frame, if this method are not called, the animation stops.
Usage
If you want to request a frame, just call jframes.request()
var req = jframes; // jframes.release(req); // release resources
The function pass to jframes.request()
will generate a frame sequence correspond to the function. The function will be the action of the frame sequence.
We keep track of frame informations for every frame sequence. You can use jframes.request()
multi times without worry of calculation. For example:
jframes; jframes;