Workshop › Pool › Step 10 of 33
Every frame each ball moves by its velocity. step is one step of the physics; update runs it, and the loop calls
update before draw.
```js
function step() {
for (const b of balls) {
b.x += b.vx
b.y += b.vy
}
}
function update() {
step()
}
update()
```step adds each ball's velocity to its position.loop now calls update() before draw().step and update, each followed by an empty line.loop, call update() before draw(). Run and press Space.Skills: Velocity and gravity, The game loop
← A shot is a velocity Friction →