Workshop › Rhythm Lanes › Step 1 of 35
Hit the notes as they reach the line. A song written as text, notes placed by time and drawn from the clock, timing windows for perfect and good, misses, combos that raise a multiplier, accuracy and a grade, and lanes you can tap on a phone.
In a rhythm game notes slide down lanes towards a line, and you press the lane's key the moment a note reaches it. First the stage: find the canvas, take its pen and paint it dark.
```js
const canvas = document.getElementById('game')
const ctx = canvas.getContext('2d')
ctx.fillStyle = '#0f172a'
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 (400, 560) make it cover everything.Write the lines under the three comment lines, then press Run.
Skills: Drawing on a canvas