20 lines
584 B
JavaScript
20 lines
584 B
JavaScript
import { App } from './app.js';
|
|
import { Scene, SceneLayer } from './scene.js';
|
|
import { Rect, StrokeRect } from './objects.js';
|
|
|
|
let app = new App(document.querySelector('canvas'), 400, 400);
|
|
|
|
let firstScene = new Scene(app.canvas, app.context, 400, 400);
|
|
let firstLayer = new SceneLayer('background', [
|
|
new Rect(50, 50, 100, 100, 'red'),
|
|
new StrokeRect(150, 150, 40, 40, 'green', 'blue', 1),
|
|
]);
|
|
firstScene.addLayer(firstLayer);
|
|
|
|
app.scene = firstScene;
|
|
|
|
// add app view in document
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
document.body.appendChild(app.view);
|
|
});
|