Class: ABM.Animator
Defined in: | src/animator.coffee |
Instance Method Summary
- # (void) setRate(rate, multiStep = @model) Adjust animator.
- # (void) start() Starts model.
- # (void) stop() Stops the model, used for debugging and resetting model.
- # (void) resetTimes() Internal util: reset time instance variables.
- # (void) reset() Reset used by model.reset when resetting model.
- # (void) step() Two handlers used by animation loop.
- # (void) draw()
- # (void) once() Step and draw the model once, mainly used for debugging.
- # (void) now() Get current time, with high resolution timer if available.
- # (void) ms() Time in ms since starting animator.
- # (void) ticksPerSec() Get ticks/draws per second.
- # (void) drawsPerSec()
- # (void) toString() Return a status string for debugging and logging performance.
- # (void) animateSteps() Bound Animation via setTimeout and requestAnimationFrame.
- # (void) animateDraws() Bound
- # (void) animate()
Constructor Details
#
(void)
constructor(rate = 30, multiStep = @model)
Create initial animator for the model, specifying default rate (fps) and multiStep. If multiStep, run the draw() and step() methods separately by draw() using requestAnimationFrame and step() using setTimeout.
Instance Method Details
#
(void)
setRate(rate, multiStep = @model)
Adjust animator. Call before model.start() in setup() to change default settings.
#
(void)
start()
Starts model.
#
(void)
stop()
Stops the model, used for debugging and resetting model.
#
(void)
resetTimes()
Internal util: reset time instance variables.
#
(void)
reset()
Reset used by model.reset when resetting model.
#
(void)
step()
Two handlers used by animation loop.
#
(void)
draw()
#
(void)
once()
Step and draw the model once, mainly used for debugging.
#
(void)
now()
Get current time, with high resolution timer if available.
#
(void)
ms()
Time in ms since starting animator.
#
(void)
ticksPerSec()
Get ticks/draws per second. They will differ if multiStep. The "if" is to avoid from ms=0.
#
(void)
drawsPerSec()
#
(void)
toString()
Return a status string for debugging and logging performance.
#
(void)
animateSteps()
Bound
Animation via setTimeout and requestAnimationFrame.
#
(void)
animateDraws()
Bound
#
(void)
animate()