1.0.2 • Published 6 years ago

canvas-mix v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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.