Accessors
note
All Module accessors are available in this class.
duration
Type: number
Duration of the last frame in ms.
const raf = new Raf();
raf.duration; // returns duration of the last frame in ms
fps
Type: number
Real-time FPS. See demo
const raf = new Raf();
raf.fps; // returns real-time fps
fpsFactor
Type: number
Scaling coefficient based on a 60 FPS target.
Useful for making physics and easing consistent regardless of monitor refresh rate.
See demo
const raf = new Raf();
raf.fpsFactor; // returns scaling coefficient
index
Type: number
Current frame index. See demo
const raf = new Raf();
raf.index; // returns frame index
isPlaying
Type: boolean
Playback state of the RAF loop.
const raf = new Raf();
raf.isPlaying; // true or false
timestamp
Type: number
Timestamp of the current frame. See demo
const raf = new Raf();
raf.timestamp; // returns timestamp