canvas-mix

1.0.2 • Public • Published

MIX - A javascript game context

Mix is an awesome minimal real gaming library.

It creates a common interface for 2D graphics, audio, input, asset loading and timing events. Under the hood, Mix uses WebGL to give you fast 2D graphics with shaders support.

Simply include the script on a page installs a new context for <canvas> elements.

let mix = document.getElementById("myCanvas").getContext("mix");

const assets = {};
let x = 0;

function init(assets) {
  assets.sprite = mix.createImage("mysprite.png");
}

function frame(dt) {
  mix.draw(assets.sprite, x, 10);

  if (mix.press("a")) x -= 100 * dt;
  if (mix.press("d")) x += 100 * dt;
}

mix.run([], init, frame);

Check the API documentation for more info.

Readme

Keywords

Package Sidebar

Install

npm i canvas-mix

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

1.29 MB

Total Files

63

Last publish

Collaborators

  • fserb