-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got a lot farther, but still can't render pixels
- Loading branch information
1 parent
4928cdf
commit 557bda8
Showing
8 changed files
with
213 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
target/ | ||
dist/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as wasm from "./pkg/index_bg.wasm"; | ||
wasm.init_panic_hook(); | ||
document.body.style.margin = 0; | ||
let canvas = document.getElementById("bg-canvas"); | ||
let ctx = canvas.getContext("2d"); | ||
canvas.width = window.innerWidth; | ||
canvas.height = window.innerHeight; | ||
ctx.fillStyle = "black"; | ||
ctx.fillRect(0, 0, canvas.width, canvas.height); | ||
let universe = wasm.universe_new(ctx); | ||
|
||
const renderLoop = () => { | ||
debugger; | ||
wasm.universe_tick(universe).catch(console.error); | ||
requestAnimationFrame(renderLoop); | ||
}; | ||
|
||
renderLoop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> | ||
<title>Animated Background Demo</title> | ||
</head> | ||
|
||
<body> | ||
<canvas id="bg-canvas" style="position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: -1;"></canvas> | ||
<canvas id="bg-canvas"></canvas> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.