Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This section deals with programming issues related to throttling graphical updates in JavaScript to give the user an optimal experience. We want graphics that have smooth and fluid movement, and that are neither too quick nor too slow. The performance of the user’s computer will influence how fast moving graphics are updated. I’ll also discuss a solution for reducing these apparent speed variations on different machines.
JavaScript’s setInterval() and setTimeout() functions allow you to call JavaScript code at regular intervals. Applications that require regular graphical updates, such as arcade games, would be difficult, if not impossible, to write without them.