caviar web example
HTML
<script type="module">
import {
Rectangle,
Scene,
World,
} from "https://deno.land/x/caviar@2.4.9/web/dist/mod.js";
class Game extends Scene {
rect = new Rectangle(20, 20, 50, 50, "#0000ff");
setup() {
this.setBackground("#000000")
this.addChild(this.rect);
}
update() {
this.rect.x += 5;
}
}
const test = new World({
title: "test",
width: 800,
height: 600,
resizable: true,
id: "example-canvas"
}, [Game]);
await test.start();
</script>