/obelisk.js

JavaScript Engine for Building Isometric Pixel Element with HTML5 Canvas

Primary LanguageJavaScriptMIT LicenseMIT

Obelisk.js

Obelisk.js is a JavaScript Engine for building isometric pixel objects.

With the simple and flexible API provided by it, you can easily add isometric pixel element like brick, cube, pyramid onto HTML5 canvas. Obelisk.js strictly follows the pixel neat pattern: lines with 1:2 pixel dot arrangement, leading to an angle of 22.6 degrees.

You should know this is not for vector isometric graphics drawing. In fact it is not using any canvas graphic drawing API at all, instead, it manipulates all the things in pixel level to obtain typical pixel arrangement. Just try it out to pixelate something. Have fun.

Showcase

Origin:

User Contributed:

Getting started

Simply include obelisk.js in your project

<script src="//path/to/obelisk.min.js"></script>

Create pixel world

// create a canvas 2D point for pixel view world
var point = new obelisk.Point(200, 200);

// create view instance to nest everything
// canvas could be either DOM or jQuery element
var pixelView = new obelisk.PixelView(canvas, point);

// create cube dimension and color instance
var dimension = new obelisk.CubeDimension(80, 100, 120);
var gray = obelisk.ColorPattern.GRAY;
var color = new obelisk.CubeColor().getByHorizontalColor(gray);

// build cube with dimension and color instance
var cube = new obelisk.Cube(dimension, color, true);

// render cube primitive into view
pixelView.renderObject(cube);

You can find out more details in tutorial part 1: To build the first cube or try the code yourself

Tutorials

Step by step:

Sample code for building all primitives:

Roadmap

To add more pixel primitives - 4 directions slopes will be the first

Get in Touch

  • Build any cool stuff? Please feel free to add it here: User Contributed Showcase I prefer you not to send PR to update README.md, someone will update it at some point:)
  • Bugs & Suggestions: open an issue
  • Twitter: @rison

Changelog

See details in the release notes.

References

Pixel art is a form of digital art, where images are edited and displayed on the pixel level. The isometric projection is commonly seen in games to provide a 3D view without using any real 3D processing.

License

Obelisk.js is released under the MIT License