Command Palette

Search for a command to run...

Hectal
Phase 17: Performance
3D Web · Exercise 4 of 4 Previous
Advanced

Draw only when needed

The loop draws 60 pictures a second although nothing moves. Draw a picture only when the camera has moved (use controls.addEventListener("change", ...)), plus once at the start.

After one second of nobody touching anything, at most 3 frames should have been drawn.

What Check tests

  1. A first picture is drawn
  2. After one idle second, at most 3 frames in total

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.