Workshop › Typing Rain › Step 1 of 33
Type the falling words before they land. Measuring text to place it, locking on to the most urgent word, drawing half a word in another color, lives, levels tuned by measuring real typing speeds, words per minute and accuracy, and a keyboard that lights up the next key.
In this game words fall from the sky, and you type them before they land. First the sky: find the canvas, take its pen and paint it night blue.
```js
const canvas = document.getElementById('game')
const ctx = canvas.getContext('2d')
ctx.fillStyle = '#020617'
ctx.fillRect(0, 0, canvas.width, canvas.height)
```document.getElementById('game') finds the canvas; const canvas = names it.canvas.getContext('2d') gives the pen with all drawing commands; we call it ctx.fillStyle picks a color, fillRect(x, y, width, height) fills a rectangle. (0, 0) is the top-left corner, and
canvas.width, canvas.height (480, 480) make it cover everything.Write the lines under the three comment lines, then press Run.
Skills: Drawing on a canvas