Beginner
Make the canvas follow its box
The canvas is sized once, to a fixed 200 × 100 pixels. Make it fill the <div id="app">, keep the camera's aspect in step with the box, and cap the pixel ratio at 2.
Use a ResizeObserver on #app, so it also works when only the box changes size.
What Check tests
- The canvas fills the box
- The camera aspect equals width / height
- It uses a ResizeObserver
- The pixel ratio is at most 2
- It follows when only the box changes
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.