Skip to content

Commit

Permalink
Fix link to EventListener (#24587)
Browse files Browse the repository at this point in the history
* Fix link to EventListener

* Fix typo

* Fix typo

* Update files/en-us/web/api/canvas_api/tutorial/basic_animations/index.md

Co-authored-by: Hamish Willee <[email protected]>

---------

Co-authored-by: Hamish Willee <[email protected]>
  • Loading branch information
teoli2003 and hamishwillee authored Feb 20, 2023
1 parent a206991 commit db59cf2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ First there's the {{domxref("setInterval()")}}, {{domxref("setTimeout()")}}, and
- {{domxref("Window.requestAnimationFrame()", "requestAnimationFrame(callback)")}}
- : Tells the browser that you wish to perform an animation and requests that the browser call a specified function to update an animation before the next repaint.

If you don't want any user interaction you can use the `setInterval()` function which repeatedly executes the supplied code. If we wanted to make a game, we could use keyboard or mouse events to control the animation and use `setTimeout()`. By setting {{domxref("EventListener")}}s, we catch any user interaction and execute our animation functions.
If you don't want any user interaction you can use the `setInterval()` function, which repeatedly executes the supplied code. If we wanted to make a game, we could use keyboard or mouse events to control the animation and use `setTimeout()`. By setting listeners using {{domxref("Window.addEventListener", "addEventListener()")}}, we catch any user interaction and execute our animation functions.

> **Note:** In the examples below, we'll use the {{domxref("window.requestAnimationFrame()")}} method to control the animation. The `requestAnimationFrame` method provides a smoother and more efficient way for animating by calling the animation frame when the system is ready to paint the frame. The number of callbacks is usually 60 times per second and may be reduced to a lower rate when running in background tabs. For more information about the animation loop, especially for games, see the article [Anatomy of a video game](/en-US/docs/Games/Anatomy) in our [Game development zone](/en-US/docs/Games).
Expand Down

0 comments on commit db59cf2

Please sign in to comment.