Workshop › Pool › Step 18 of 33
A pool table has six pockets: the four corners and the middle of each long side. Each pocket is a pair of numbers [x, y],
drawn as a dark circle.
```js
const POCKETS = [
[LEFT, TOP], [240, TOP], [RIGHT, TOP],
[LEFT, BOTTOM], [240, BOTTOM], [RIGHT, BOTTOM],
]
const POCKET_R = 15
for (const [px, py] of POCKETS) {
ctx.fillStyle = '#020617'
ctx.beginPath()
ctx.arc(px, py, POCKET_R, 0, Math.PI * 2)
ctx.fill()
}
```POCKETS is an array of six [x, y] pairs: the corners of the felt and x = 240 on the top and bottom edges.for (const [px, py] of POCKETS) takes each pair apart into px and py.COLORS write POCKETS and POCKET_R.draw, right under the felt's fillRect, write the pocket loop.Skills: Drawing on a canvas, Arrays and objects
← Swap the push In the pocket →