Workshop › Pong › Step 2 of 26
Our first drawing: the whole canvas becomes black, like the old arcade screens. Drawing is always two moves: pick a color, then fill a shape with it.
```js
ctx.fillStyle = 'black'
ctx.fillRect(0, 0, canvas.width, canvas.height)
```ctx.fillStyle = 'black' picks the fill color.ctx.fillRect(x, y, width, height) fills a rectangle. 0, 0 is the top-left corner, and canvas.width and
canvas.height (600 and 400) make it cover everything.Leave an empty line under const ctx = ..., write the two lines, then press Run.
Skills: Drawing on a canvas
← Get the canvas and the pen One dash of the net →