JSPM

  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q19675F
  • License MIT

A canvas object model lib.

Package Exports

  • canvasom

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (canvasom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

canvasom

A canvas object model lib.

Introduction

canvasom is a canvas object model lib that provides you with DOM-like APIs to manipulate canvas graphics. The goal of this lib is to make it easier to create UIs in canvas.

Example

const root = COM.create('root', {
    id: 'root',
    width: 480,
    height: 320,
}, [
    COM.create('text', {
        data: 'Hello, world!',
        x: 240,
        y: 160,
        style: {
            font: 'bold 30px Consolas',
            textAlign: 'center',
            textBaseline: 'middle',
        }
    })
]);

document.body.appendChild(root.canvas);