hengine
TypeScript icon, indicating that this package has built-in type declarations

0.42.1 • Public • Published

hengine

A simple graphic engine for canvasom.

Links

Example

const engine = new HE.CanvasEngine({
    interactive: true,
    renderer: new COM.Renderer({
        canvas: document.getElementById('canvas'),
        width: 480,
        height: 320,
        ratio: 2,
    }),
    style: {
        fillStyle: '#FFF',
    },
    resizerOptions: {
        container: document.body,
        padding: 10,
    },
});

const startScene = COM.create(HE.SceneNode, {
    id: 'start-scene',
}, [
    COM.create(COM.TextNode, {
        stretch: 1,
        content: 'hello world',
        style: {
            fillStyle: '#000',
            textAlign: 'center',
            textBaseline: 'middle',
        },
    }),
]);

engine.enter(startScene);

engine.resizer.update(() => {
    engine.updateAndRender();
});

Package Sidebar

Install

npm i hengine

Weekly Downloads

77

Version

0.42.1

License

MIT

Unpacked Size

33.2 kB

Total Files

11

Last publish

Collaborators

  • 3h