Workshop › Flappy-style Bird › Step 6 of 30
A game loop runs again and again: update, draw, and ask the browser to run it again before the next screen refresh
(requestAnimationFrame, about 60 times a second).
```js
function loop() {
update()
draw()
requestAnimationFrame(loop)
}
requestAnimationFrame(loop)
```loop runs one turn: move, then draw.requestAnimationFrame(loop) inside it books the next turn, so it keeps going.draw() call.loop has no parentheses there: we hand over the function, the browser calls it later.Replace the draw() call at the bottom with the loop function and requestAnimationFrame(loop).
Skills: The game loop
← A function that moves Gravity →