Intermediate
Make it sharp at ratio 2
The canvas is 160 × 60 CSS pixels. On a screen with pixel ratio 2 it should have a 320 × 120 grid, but still draw in CSS pixels.
Finish setupCanvas(canvas, 160, 60, 2): the grid, the box, and one setTransform. The rectangle is drawn at (10, 10) 40 × 20 CSS pixels.
What Check tests
- The grid is 320 × 120
- The box is 160 CSS pixels wide
- The rectangle fills device pixels 20 to 100
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.