rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.73k stars 208 forks source link

The initial state of the universe is never displayed #118

Closed jwir3 closed 5 years ago

jwir3 commented 5 years ago

Describe the bug The initial state of the universe is never displayed, because requestAnimationFrame() calls universe.tick() before calling drawCells().

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Implementing'
  2. Copy and paste the necessary code (for the canvas drawing variant).
  3. Build and run.

Expected behavior An 8x8 grid should display the following:

screen shot 2018-10-19 at 5 19 16 pm

Actual Behavior The 8x8 grid displays the second frame, rather than the first, which is:

screen shot 2018-10-19 at 5 20 21 pm