FrameTimer
This is a library of timer by packaging requestAnimationFrame
so that you can use it easily.
Download
npm install frame-timer
Use In Browser
Parameters
Of course, you can pass parameters into timer callback as well.
let { console;};let msg = "message";timer;
You also can directly pass parameter of the interval (16~17ms
) between 2 frames in timer.run()
.
let msg = "message";let { console; console;};/* pls note that you only need to put your params, no need put 'dt' into run callback function because dt has been appended into arguments so that you can use it directly in callback function*/ timer;