Closed You-saku closed 1 year ago
You need to call requestAnimationFrame(renderLoop) once outside of renderLoop.
import { Universe } from "wasm-game-of-life";
const pre = document.getElementById("game-of-life-canvas");
const universe = Universe.new();
const renderLoop = () => {
pre.textContent = universe.render();
universe.tick();
requestAnimationFrame(renderLoop);
};
requestAnimationFrame(renderLoop);
This should do the trick. It's also mentioned in the book btw.
@VolkerFelix
You need to call requestAnimationFrame(renderLoop) once outside of renderLoop.
Thanks. I could't notice this. Do the trick now.
This issue close.
I'm sorry if this is not the place for asking for help. I wrote the code referring to 4.4. Implementing Life(rust-implementation) and when I ran it, did not show in the browser. Where did I go wrong?
src/lib.rs
www/index.js