Stack - isometrickObelisk.js Example

In this example below you will see how to do a Stack - isometrickObelisk.js Example with some HTML / CSS and Javascript

An example on what you can do using isometricObelisk javascript module from https://github.com/GeorgeGkas/isometricObelisk.js

Thumbnail
This awesome code was written by georgegkas, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright georgegkas ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Stack - isometrickObelisk.js Example</title>
  
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="universe">
  <canvas id="world" width="800" height="600"></canvas>
</div>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/georgegkas/stack-isometrickobeliskjs-example-oLbLjQ */
* {
  margin: 0;
  box-sizing: border-box;
}

body {
  background-color: #222222;
}

.universe {
  width: 800px;
  height: 600px;
  margin: 10px auto;
  background-color: #fff;
  overflow: hidden;
}

#world {
  background-color: #FF5F6D;
}

/*Downloaded from https://www.codeseek.co/georgegkas/stack-isometrickobeliskjs-example-oLbLjQ */
/*!
 * obelisk.js - 1.2.2
 * https://github.com/nosir/obelisk.js
 * MIT licensed
 *
 * Copyright (C) 2012-2016 Max Huang https://github.com/nosir/
 */

!function i(t,s,n){function e(a,r){if(!s[a]){if(!t[a]){var h="function"==typeof require&&require;if(!r&&h)return h(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var m=s[a]={exports:{}};t[a][0].call(m.exports,function(i){var s=t[a][1][i];return e(s?s:i)},m,m.exports,i,t,s,n)}return s[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)e(n[a]);return e}({1:[function(i,t,s){"use strict";var n,e;n=function(){this.initialize()},e=n.prototype,e.inner=null,e.border=null,e.borderHighlight=null,e.left=null,e.right=null,e.horizontal=null,e.leftSlope=null,e.rightSlope=null,e.initialize=function(){return this},e.toString=function(){return"[AbstractColor]"},t.exports=n},{}],2:[function(i,t,s){"use strict";var n,e,o=i("./AbstractColor"),a=i("../utils/ColorGeom");n=function(i,t,s,n,e){this.initialize(i,t,s,n,e)},e=n.prototype=new o,e.BRIGHTNESS_GAIN=-20,e.initialize=function(i,t,s,n,e){return this.border=a.get32(void 0===i?8882055:i),this.borderHighlight=a.get32(void 0===t?16777215:t),this.left=a.get32(void 0===s?13225936:s),this.right=a.get32(void 0===n?14935011:n),this.horizontal=a.get32(void 0===e?15658992:e),this},e.getByHorizontalColor=function(i){return new n(a.applyBrightness(i,4*this.BRIGHTNESS_GAIN),a.applyBrightness(i,0,!0),a.applyBrightness(i,2*this.BRIGHTNESS_GAIN),a.applyBrightness(i,this.BRIGHTNESS_GAIN),i)},e.toString=function(){return"[CubeColor]"},t.exports=n},{"../utils/ColorGeom":39,"./AbstractColor":1}],3:[function(i,t,s){"use strict";var n,e,o=i("./AbstractColor"),a=i("../utils/ColorGeom");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.initialize=function(i){return this.border=a.get32(void 0===i?8882055:i),this},e.toString=function(){return"[LineColor]"},t.exports=n},{"../utils/ColorGeom":39,"./AbstractColor":1}],4:[function(i,t,s){"use strict";var n,e,o=i("./AbstractColor"),a=i("../utils/ColorGeom");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new o,e.BRIGHTNESS_GAIN=-20,e.initialize=function(i,t,s,n){return this.border=a.get32(void 0===i?9737880:i),this.borderHighlight=a.get32(void 0===t?16777215:t),this.left=a.get32(void 0===s?15132905:s),this.right=a.get32(void 0===n?15658992:n),this},e.getByRightColor=function(i){return new n(a.applyBrightness(i,4*this.BRIGHTNESS_GAIN),a.applyBrightness(i,0,!0),a.applyBrightness(i,this.BRIGHTNESS_GAIN),i)},e.toString=function(){return"[PyramidColor]"},t.exports=n},{"../utils/ColorGeom":39,"./AbstractColor":1}],5:[function(i,t,s){"use strict";var n,e,o=i("./AbstractColor"),a=i("../utils/ColorGeom");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.BRIGHTNESS_GAIN=-20,e.initialize=function(i,t){return this.border=a.get32(void 0===i?8882055:i),this.inner=a.get32(void 0===t?15658734:t),this},e.getByInnerColor=function(i){return new n(a.applyBrightness(i,4*this.BRIGHTNESS_GAIN),i)},e.toString=function(){return"[SideColor]"},t.exports=n},{"../utils/ColorGeom":39,"./AbstractColor":1}],6:[function(i,t,s){"use strict";var n,e,o=i("./AbstractColor"),a=i("../utils/ColorGeom");n=function(i,t,s,n,e,o){this.initialize(i,t,s,n,e,o)},e=n.prototype=new o,e.BRIGHTNESS_GAIN=-20,e.initialize=function(i,t,s,n,e,o){return this.border=a.get32(void 0===i?9737880:i),this.borderHighlight=a.get32(void 0===t?16777215:t),this.left=a.get32(void 0===s?13225936:s),this.right=a.get32(void 0===n?15132905:n),this.leftSlope=a.get32(void 0===e?14408667:e),this.rightSlope=a.get32(void 0===o?14408667:o),this},e.getByHorizontalColor=function(i){return new n(a.applyBrightness(i,4*this.BRIGHTNESS_GAIN),a.applyBrightness(i,0,!0),a.applyBrightness(i,2*this.BRIGHTNESS_GAIN),a.applyBrightness(i,this.BRIGHTNESS_GAIN),a.applyBrightness(i,1.5*this.BRIGHTNESS_GAIN),a.applyBrightness(i,.5*this.BRIGHTNESS_GAIN))},e.toString=function(){return"[SlopeColor]"},t.exports=n},{"../utils/ColorGeom":39,"./AbstractColor":1}],7:[function(i,t,s){"use strict";var n,e;n=function(){this.initialize()},e=n.prototype,e.xAxis=null,e.yAxis=null,e.zAxis=null,e.tall=!1,e.initialize=function(){return this},e.toString=function(){return"[AbstractDimension]"},t.exports=n},{}],8:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.initialize=function(i,t){if(this.xAxis=i||30,this.yAxis=t||30,this.xAxis%2===1||this.yAxis%2===1)throw new Error("x,yAxis must be even number");if(this.xAxis<=4||this.yAxis<=4)throw new Error("dimension is too small");return this},e.toString=function(){return"[BrickDimension]"},t.exports=n},{"./AbstractDimension":7}],9:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i,t,s){this.initialize(i,t,s)},e=n.prototype=new o,e.initialize=function(i,t,s){if(this.xAxis=i||30,this.yAxis=t||30,this.zAxis=s||30,this.xAxis%2===1||this.yAxis%2===1)throw new Error("x,yAxis must be even number");if(this.xAxis<=4||this.yAxis<=4||this.zAxis<=2)throw new Error("dimension is too small");return this},e.toString=function(){return"[CubeDimension]"},t.exports=n},{"./AbstractDimension":7}],10:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i){this.initialize(i)},e=n.prototype=new o,e.initialize=function(i){if(this.xAxis=i||30,this.xAxis%2===1)throw new Error("xAxis must be even number");if(this.xAxis<2)throw new Error("dimension is too small");return this},e.toString=function(){return"[LineXDimension]"},t.exports=n},{"./AbstractDimension":7}],11:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i){this.initialize(i)},e=n.prototype=new o,e.initialize=function(i){if(this.yAxis=i||30,this.yAxis%2===1)throw new Error("yAxis must be even number");if(this.yAxis<2)throw new Error("dimension is too small");return this},e.toString=function(){return"[LineYDimension]"},t.exports=n},{"./AbstractDimension":7}],12:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i){this.initialize(i)},e=n.prototype=new o,e.initialize=function(i){if(this.zAxis=i||30,this.zAxis<=0)throw new Error("dimension is too small");return this},e.toString=function(){return"[LineZDimension]"},t.exports=n},{"./AbstractDimension":7}],13:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.initialize=function(i,t){if(this.xAxis=i||30,this.yAxis=i||30,this.tall=t||!1,this.xAxis%2===1)throw new Error("axis must be even number");if(this.xAxis<=4)throw new Error("dimension is too small");return this},e.toString=function(){return"[PyramidDimension]"},t.exports=n},{"./AbstractDimension":7}],14:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.initialize=function(i,t){if(this.xAxis=i||30,this.zAxis=t||30,this.xAxis%2===1)throw new Error("xAxis must be even number");if(this.xAxis<=4||this.zAxis<=2)throw new Error("dimension is too small");return this},e.toString=function(){return"[SideXDimension]"},t.exports=n},{"./AbstractDimension":7}],15:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.initialize=function(i,t){if(this.yAxis=i||30,this.zAxis=t||30,this.yAxis%2===1)throw new Error("yAxis must be even number");if(this.yAxis<=4||this.zAxis<=2)throw new Error("dimension is too small");return this},e.toString=function(){return"[SideYDimension]"},t.exports=n},{"./AbstractDimension":7}],16:[function(i,t,s){"use strict";var n,e,o=i("./AbstractDimension");n=function(i,t){this.initialize(i,t)},e=n.prototype=new o,e.initialize=function(i,t){if(this.xAxis=i||30,this.yAxis=t||30,this.xAxis%2===1||this.yAxis%2===1)throw new Error("xAxis and yAxis must be even number");if(this.xAxis<=4||this.yAxis<=4)throw new Error("dimension is too small");return this},e.toString=function(){return"[SlopeDimension]"},t.exports=n},{"./AbstractDimension":7}],17:[function(i,t,s){"use strict";var n,e,o=i("../utils/CanvasManager");n=function(i,t,s){this.initialize(i,t,s)},e=n.prototype,e.imageData=null,e.canvas=null,e.context=null,e.initialize=function(i,t,s){if(void 0===i||void 0===t)throw new Error("BitmapData width or height is missing");return s?this.canvas=o.getDefaultCanvas():this.canvas=o.getNewCanvas(),this.canvas.setAttribute("width",i),this.canvas.setAttribute("height",t),this.context=this.canvas.getContext("2d"),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.mozImageSmoothingEnabled=!1,this.context.msImageSmoothingEnabled=!1,this.context.imageSmoothingEnabled=!1,this.imageData=this.context.createImageData(i,t),this},e.setPixel=function(i,t,s){var n=4*(t*this.imageData.width+i);this.setPixelByIndex(n,s)},e.setPixelByIndex=function(i,t){var s=this.imageData.data;s[i]=t>>>16&255,s[i+1]=t>>>8&255,s[i+2]=t>>>0&255,s[i+3]=t>>>24&255},e.checkPixelAvailable=function(i,t){var s=4*(t*this.imageData.width+i);return 0===this.imageData.data[s+3]},e.floodFill=function(i,t,s){if(0!==(s>>>24&255)){var n,e,o,a,r,h,l=i,m=t,c=[],d=[],x=[],u=this.imageData.width,f=this.imageData.height;if(!(0>l||0>m||l>=u||m>=f)){if(!this.checkPixelAvailable(l,m))throw new Error("Start point for flood fill is already filled");for(n=l;n>=0;n-=1){for(e=m;e>=0;e-=1){if(!this.checkPixelAvailable(n,e)){if(e===m&&this.checkPixelAvailable(n+1,e-1))for(a=this.checkPixelAvailable(n,e-1)?e-1:this.checkPixelAvailable(n+1,e-2)?e-2:-1,e=a;e>=0&&this.checkPixelAvailable(n,e);e-=1)c.push(4*(e*u+n)),d.push(e);break}c.push(4*(e*u+n)),d.push(e)}for(e=m;f>e;e+=1){if(!this.checkPixelAvailable(n,e)){if(e===m&&this.checkPixelAvailable(n+1,e+1))for(a=this.checkPixelAvailable(n,e+1)?e+1:this.checkPixelAvailable(n+1,e+2)?e+2:f,e=a;f>e&&this.checkPixelAvailable(n,e);e+=1)c.push(4*(e*u+n)),d.push(e);break}c.push(4*(e*u+n)),d.push(e)}for(n===l&&(x=d.concat()),o=!1,r=0;r<x.length;r+=1){for(h=0;h<x.length;h+=1)if(d[h]===x[r]){o=!0,m=x[r];break}if(o)break}if(!o)break;x=d.concat(),d=[]}for(l=i,m=t,x=[],d=[],n=l;u>n;n+=1){for(e=m;e>=0;e-=1){if(!this.checkPixelAvailable(n,e)){if(e===m&&this.checkPixelAvailable(n-1,e-1))for(a=this.checkPixelAvailable(n,e-1)?e-1:this.checkPixelAvailable(n-1,e-2)?e-2:-1,e=a;e>=0&&this.checkPixelAvailable(n,e);e-=1)c.push(4*(e*u+n)),d.push(e);break}c.push(4*(e*u+n)),d.push(e)}for(e=m;f>e;e+=1){if(!this.checkPixelAvailable(n,e)){if(e===m&&this.checkPixelAvailable(n-1,e+1))for(a=this.checkPixelAvailable(n,e+1)?e+1:this.checkPixelAvailable(n-1,e+2)?e+2:f,e=a;f>e&&this.checkPixelAvailable(n,e);e+=1)c.push(4*(e*u+n)),d.push(e);break}c.push(4*(e*u+n)),d.push(e)}for(n===l&&(x=d.concat()),o=!1,r=0;r<x.length;r+=1){for(h=0;h<x.length;h+=1)if(d[h]===x[r]){o=!0,m=x[r];break}if(o)break}if(!o)break;x=d.concat(),d=[]}for(r=0;r<c.length;r+=1)this.setPixelByIndex(c[r],s)}}},e.toString=function(){return"[BitmapData]"},t.exports=n},{"../utils/CanvasManager":37}],18:[function(i,t,s){"use strict";var n,e,o=i("../geom/Point3D");n=function(i,t){this.initialize(i,t)},e=n.prototype,e.x=null,e.y=null,e.canvas=null,e.initialize=function(i,t){if(!i)throw new Error("Primitive is not defined");var s=t||new o;return this.canvas=i.canvas,this.x=i.matrix.tx+s.x-s.y,this.y=i.matrix.ty+Math.floor(s.x/2+s.y/2)-s.z,this},e.toString=function(){return"[PixelObject]"},t.exports=n},{"../geom/Point3D":22}],19:[function(i,t,s){"use strict";var n,e,o=i("../geom/Point"),a=i("../display/PixelObject");n=function(i,t){this.initialize(i,t)},e=n.prototype,e.canvas=null,e.context=null,e.point=null,e.initialize=function(i,t){if(!i)throw new Error("Canvas is not defined");try{i instanceof jQuery&&(i=i.get(0))}catch(s){}return this.canvas=i,this.context=this.canvas.getContext("2d"),this.context.mozImageSmoothingEnabled=!1,this.context.msImageSmoothingEnabled=!1,this.context.imageSmoothingEnabled=!1,this.point=t||new o(0,0),this},e.renderObject=function(i,t){var s=new a(i,t);this.context.drawImage(s.canvas,this.point.x+s.x,this.point.y+s.y)},e.clear=function(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},e.toString=function(){return"[PixelView]"},t.exports=n},{"../display/PixelObject":18,"../geom/Point":21}],20:[function(i,t,s){"use strict";var n,e;n=function(i,t,s,n,e,o){this.initialize(i,t,s,n,e,o)},e=n.prototype,e.a=1,e.b=0,e.c=0,e.d=1,e.tx=0,e.ty=0,e.initialize=function(i,t,s,n,e,o){return this.a=void 0===i?1:i,this.b=t||0,this.c=s||0,this.d=void 0===n?1:n,this.tx=e||0,this.ty=o||0,this},e.toString=function(){return"[Matrix]"},t.exports=n},{}],21:[function(i,t,s){"use strict";var n,e;n=function(i,t){this.initialize(i,t)},e=n.prototype,e.x=0,e.y=0,e.initialize=function(i,t){return this.x=void 0===i?0:i,this.y=void 0===t?0:t,this},e.toString=function(){return"[Point x : "+this.x+", y : "+this.y+"]"},t.exports=n},{}],22:[function(i,t,s){"use strict";var n,e,o=i("./Point");n=function(i,t,s){this.initialize(i,t,s)},e=n.prototype,e.x=0,e.y=0,e.z=0,e.initialize=function(i,t,s){return this.x=void 0===i?0:i,this.y=void 0===t?0:t,this.z=void 0===s?0:s,this},e.toGlobalCoordinates=function(i){var t=new o(this.x-this.y,Math.floor(this.x/2+this.y/2)-this.z);return void 0!==i&&(t.x=t.x+i.x,t.y=t.y+i.y),t},e.toString=function(){return"[Point3D x : "+this.x+", y : "+this.y+", z: "+this.z+"]"},t.exports=n},{"./Point":21}],23:[function(i,t,s){"use strict";var n={};n.Cube=i("./primitives/Cube"),n.Brick=i("./primitives/Brick"),n.Pyramid=i("./primitives/Pyramid"),n.LineX=i("./primitives/LineX"),n.LineY=i("./primitives/LineY"),n.LineZ=i("./primitives/LineZ"),n.SideX=i("./primitives/SideX"),n.SideY=i("./primitives/SideY"),n.SlopeEast=i("./primitives/SlopeEast"),n.SlopeNorth=i("./primitives/SlopeNorth"),n.SlopeSouth=i("./primitives/SlopeSouth"),n.SlopeWest=i("./primitives/SlopeWest"),n.ColorPattern=i("./utils/ColorPattern"),n.ColorGeom=i("./utils/ColorGeom"),n.CanvasManager=i("./utils/CanvasManager"),n.CanvasTool=i("./utils/CanvasTool"),n.Matrix=i("./geom/Matrix"),n.Point=i("./geom/Point"),n.Point3D=i("./geom/Point3D"),n.PixelView=i("./display/PixelView"),n.PixelObject=i("./display/PixelObject"),n.BitmapData=i("./display/BitmapData"),n.BrickDimension=i("./dimensions/BrickDimension"),n.CubeDimension=i("./dimensions/CubeDimension"),n.PyramidDimension=i("./dimensions/PyramidDimension"),n.LineXDimension=i("./dimensions/LineXDimension"),n.LineYDimension=i("./dimensions/LineYDimension"),n.LineZDimension=i("./dimensions/LineZDimension"),n.SideXDimension=i("./dimensions/SideXDimension"),n.SideYDimension=i("./dimensions/SideYDimension"),n.SlopeDimension=i("./dimensions/SlopeDimension"),n.LineColor=i("./colors/LineColor"),n.CubeColor=i("./colors/CubeColor"),n.PyramidColor=i("./colors/PyramidColor"),n.SideColor=i("./colors/SideColor"),n.SlopeColor=i("./colors/SlopeColor"),window.obelisk=n,t.exports=n},{"./colors/CubeColor":2,"./colors/LineColor":3,"./colors/PyramidColor":4,"./colors/SideColor":5,"./colors/SlopeColor":6,"./dimensions/BrickDimension":8,"./dimensions/CubeDimension":9,"./dimensions/LineXDimension":10,"./dimensions/LineYDimension":11,"./dimensions/LineZDimension":12,"./dimensions/PyramidDimension":13,"./dimensions/SideXDimension":14,"./dimensions/SideYDimension":15,"./dimensions/SlopeDimension":16,"./display/BitmapData":17,"./display/PixelObject":18,"./display/PixelView":19,"./geom/Matrix":20,"./geom/Point":21,"./geom/Point3D":22,"./primitives/Brick":25,"./primitives/Cube":26,"./primitives/LineX":27,"./primitives/LineY":28,"./primitives/LineZ":29,"./primitives/Pyramid":30,"./primitives/SideX":31,"./primitives/SideY":32,"./primitives/SlopeEast":33,"./primitives/SlopeNorth":34,"./primitives/SlopeSouth":35,"./primitives/SlopeWest":36,"./utils/CanvasManager":37,"./utils/CanvasTool":38,"./utils/ColorGeom":39,"./utils/ColorPattern":40}],24:[function(i,t,s){"use strict";var n,e;n=function(){this.initialize()},e=n.prototype,e.canvas=null,e.w=null,e.h=null,e.dimension=null,e.color=null,e.border=null,e.bitmapData=null,e.useDefaultCanvas=null,e.matrix=null,e.initialize=function(){return this},e.toString=function(){return"[AbstractPrimitive]"},t.exports=n},{}],25:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/BrickDimension"),a=i("../colors/SideColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=(this.dimension.xAxis+this.dimension.yAxis)/2,this.w-=2,this.h-=1,this.matrix=new r,this.matrix.tx=-this.dimension.yAxis+2,this.matrix.ty=0},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a;for(i=this.dimension.yAxis-2,t=0,s=this.dimension.xAxis-1,n=this.h-1,a=this.border?this.color.border:this.color.inner,e=0;e<this.dimension.xAxis;e+=1)this.bitmapData.setPixel(i+e,t+Math.floor(e/2),a),this.bitmapData.setPixel(s-e,n-Math.floor(e/2),a);for(o=0;o<this.dimension.yAxis;o+=1)this.bitmapData.setPixel(i+1-o,t+Math.floor(o/2),a),this.bitmapData.setPixel(s-1+o,n-Math.floor(o/2),a);this.bitmapData.floodFill(Math.floor(this.w/2),Math.floor(this.h/2),this.color.inner)},e.toString=function(){return"[Brick]"},t.exports=n},{"../colors/SideColor":5,"../dimensions/BrickDimension":8,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],26:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/CubeDimension"),a=i("../dimensions/BrickDimension"),r=i("../dimensions/SideXDimension"),h=i("../dimensions/SideYDimension"),l=i("../colors/CubeColor"),m=i("../colors/SideColor"),c=i("../geom/Matrix"),d=i("../display/PixelObject"),x=i("../display/BitmapData"),u=i("./AbstractPrimitive"),f=i("./Brick"),p=i("./SideX"),b=i("./SideY");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new u,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new l:t},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=this.dimension.zAxis+(this.dimension.xAxis+this.dimension.yAxis)/2,this.w-=2,this.h-=1,this.matrix=new c,this.matrix.tx=-this.dimension.yAxis+2,this.matrix.ty=-this.dimension.zAxis},e.initBitmapData=function(){this.bitmapData=new x(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,l,c,u,D,v,A,g;if(i=new f(new a(this.dimension.xAxis,this.dimension.yAxis),new m(this.color.border,this.color.horizontal),this.border),t=new p(new r(this.dimension.xAxis,this.dimension.zAxis),new m(this.color.border,this.color.left),this.border),s=new b(new h(this.dimension.yAxis,this.dimension.zAxis),new m(this.color.border,this.color.right),this.border),n=new d(i),e=new d(t),o=new d(s),l=this.bitmapData.context,l.drawImage(n.canvas,n.x+this.dimension.yAxis-2,n.y),l.drawImage(e.canvas,e.x,e.y+this.dimension.zAxis+this.dimension.yAxis/2-1),l.drawImage(o.canvas,o.x+this.w-2,e.y+this.dimension.zAxis+this.dimension.xAxis/2-1),c=new x(this.w,this.h),this.border){for(u=this.dimension.xAxis-2,D=(this.dimension.xAxis+this.dimension.yAxis)/2-2,v=0;v<this.dimension.xAxis-2;v+=1)c.setPixel(u+1-v,D-Math.floor(v/2),this.color.borderHighlight);for(A=0;A<this.dimension.yAxis-2;A+=1)c.setPixel(u+A,D-Math.floor(A/2),this.color.borderHighlight);for(g=0;g<this.dimension.zAxis;g+=1)c.setPixel(u,D+g,this.color.borderHighlight)}else for(v=0;v<this.dimension.zAxis;v+=1)c.setPixel(this.dimension.xAxis-2,(this.dimension.xAxis+this.dimension.yAxis)/2-1+v,this.color.left);c.context.putImageData(c.imageData,0,0),l.drawImage(c.canvas,0,0)},e.toString=function(){return"[Cube]"},t.exports=n},{"../colors/CubeColor":2,"../colors/SideColor":5,"../dimensions/BrickDimension":8,"../dimensions/CubeDimension":9,"../dimensions/SideXDimension":14,"../dimensions/SideYDimension":15,"../display/BitmapData":17,"../display/PixelObject":18,"../geom/Matrix":20,"./AbstractPrimitive":24,"./Brick":25,"./SideX":31,"./SideY":32}],27:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/LineXDimension"),a=i("../colors/LineColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s){this.initialize(i,t,s)},e=n.prototype=new l,e.initialize=function(i,t,s){return this.initRender(i,t,s),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s){this.useDefaultCanvas=s||!1,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis,this.h=this.dimension.xAxis/2,this.matrix=new r,this.matrix.tx=0,this.matrix.ty=0},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n;for(i=0,t=0,n=this.color.border,s=0;s<this.dimension.xAxis;s+=1)this.bitmapData.setPixel(i+s,t+Math.floor(s/2),n)},e.toString=function(){return"[LineX]"},t.exports=n},{"../colors/LineColor":3,"../dimensions/LineXDimension":10,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],28:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/LineYDimension"),a=i("../colors/LineColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s){this.initialize(i,t,s)},e=n.prototype=new l,e.initialize=function(i,t,s){return this.initRender(i,t,s),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s){this.useDefaultCanvas=s||!1,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.yAxis,this.h=this.dimension.yAxis/2,this.matrix=new r,this.matrix.tx=-this.dimension.yAxis+2,this.matrix.ty=0},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n;for(i=this.dimension.yAxis-1,t=0,n=this.color.border,s=0;s<this.dimension.yAxis;s+=1)console.log(s),this.bitmapData.setPixel(i-s,t+Math.floor(s/2),n)},e.toString=function(){return"[LineY]"},t.exports=n},{"../colors/LineColor":3,"../dimensions/LineYDimension":11,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],29:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/LineZDimension"),a=i("../colors/LineColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s){this.initialize(i,t,s)},e=n.prototype=new l,e.initialize=function(i,t,s){return this.initRender(i,t,s),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s){this.useDefaultCanvas=s||!1,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=1,this.h=this.dimension.zAxis,this.matrix=new r,this.matrix.tx=0,this.matrix.ty=-this.dimension.zAxis+1},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n;for(i=0,t=0,n=this.color.border,s=0;s<this.dimension.zAxis;s+=1)this.bitmapData.setPixel(i,t+s,n)},e.toString=function(){return"[LineZ]"},t.exports=n},{"../colors/LineColor":3,"../dimensions/LineZDimension":12,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],30:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/PyramidDimension"),a=i("../colors/PyramidColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.hSize=null,e.hOffset=null,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t,this.hSize=this.dimension.tall?2*this.dimension.xAxis:this.dimension.xAxis,this.hOffset=this.dimension.tall?-3:-2},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=this.hSize+this.dimension.xAxis/2,this.w-=2,this.h+=this.hOffset,this.matrix=new r,this.matrix.tx=-this.dimension.xAxis+2,this.matrix.ty=-this.hSize/2+2-(this.dimension.tall?this.dimension.xAxis/2:1)},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a,r,h,l;for(i=this.border?this.color.border:this.color.left,t=this.border?this.color.border:this.color.right,s=this.border?this.color.borderHighlight:i,o=0;o<this.hSize+this.dimension.xAxis/2-4;o+=1)this.bitmapData.setPixel(this.dimension.xAxis-2,o+3+this.hOffset,s);for(n=0;n<this.dimension.xAxis;n+=1)this.bitmapData.setPixel(n,this.hSize+Math.floor(n/2)+this.hOffset,i);for(e=0;e<this.dimension.xAxis;e+=1)this.bitmapData.setPixel(e+this.dimension.xAxis-2,this.hSize+this.dimension.xAxis/2-Math.floor(e/2)-1+this.hOffset,t);if(this.dimension.tall){for(h=0;h<this.hSize-2;h+=1)this.bitmapData.setPixel(Math.floor(h/2),this.hSize-h+this.hOffset,i);for(l=2;l<this.hSize;l+=1)this.bitmapData.setPixel(Math.floor(l/2)+this.dimension.xAxis-2,l+1+this.hOffset,t)}else{for(a=0;a<this.hSize;a+=1)this.bitmapData.setPixel(a,this.hSize-a+this.hOffset,i);for(r=0;r<this.hSize;r+=1)this.bitmapData.setPixel(r+this.hSize-2,r+1+this.hOffset,t)}this.border||this.bitmapData.setPixel(this.dimension.xAxis-2,this.hSize+this.dimension.xAxis/2-1+this.hOffset,i),this.bitmapData.floodFill(this.dimension.xAxis-1,this.hSize+Math.floor((this.dimension.xAxis-1)/2)+this.hOffset-1,this.color.right),this.bitmapData.floodFill(this.dimension.xAxis-3,this.hSize+Math.floor((this.dimension.xAxis-1)/2)+this.hOffset-2,this.color.left)},e.toString=function(){return"[Pyramid]"},t.exports=n},{"../colors/PyramidColor":4,"../dimensions/PyramidDimension":13,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],31:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/SideXDimension"),a=i("../colors/SideColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis,this.h=this.dimension.zAxis+this.dimension.xAxis/2,this.matrix=new r,this.matrix.tx=0,this.matrix.ty=-this.dimension.zAxis},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a;for(i=0,t=this.dimension.zAxis,s=this.dimension.xAxis-1,n=this.h-this.dimension.zAxis-1,a=this.border?this.color.border:this.color.inner,e=0;e<this.dimension.xAxis;e+=1)this.bitmapData.setPixel(i+e,t+Math.floor(e/2),a),this.bitmapData.setPixel(s-e,n-Math.floor(e/2),a);for(o=0;o<this.dimension.zAxis;o+=1)this.bitmapData.setPixel(i,t-o,a),this.bitmapData.setPixel(s,n+o,a);this.bitmapData.floodFill(Math.floor(this.w/2),Math.floor(this.h/2),this.color.inner)},e.toString=function(){return"[SideX]"},t.exports=n},{"../colors/SideColor":5,"../dimensions/SideXDimension":14,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],32:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/SideYDimension"),a=i("../colors/SideColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.yAxis,this.h=this.dimension.zAxis+this.dimension.yAxis/2,this.matrix=new r,this.matrix.tx=-this.dimension.yAxis+2,this.matrix.ty=-this.dimension.zAxis},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a;for(i=0,t=this.h-this.dimension.zAxis-1,s=this.dimension.yAxis-1,n=this.dimension.zAxis,a=this.border?this.color.border:this.color.inner,e=0;e<this.dimension.yAxis;e+=1)this.bitmapData.setPixel(i+e,t-Math.floor(e/2),a),this.bitmapData.setPixel(s-e,n+Math.floor(e/2),a);for(o=0;o<this.dimension.zAxis;o+=1)this.bitmapData.setPixel(i,t+o,a),this.bitmapData.setPixel(s,n-o,a);this.bitmapData.floodFill(Math.floor(this.w/2),Math.floor(this.h/2),this.color.inner)},e.toString=function(){return"[SideY]"},t.exports=n},{"../colors/SideColor":5,"../dimensions/SideYDimension":15,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],33:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/SlopeDimension"),a=i("../colors/SlopeColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=2*this.dimension.xAxis+this.dimension.yAxis/2,this.w-=2,this.h-=3,this.matrix=new r,this.matrix.tx=-(this.dimension.yAxis-2),this.matrix.ty=-(3*this.dimension.xAxis/2-2)},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a;for(i=this.border?this.color.border:this.color.left,t=this.border?this.color.border:this.color.rightSlope,n=0;n<this.dimension.yAxis;n+=1)this.bitmapData.setPixel(n,this.dimension.yAxis/2-Math.floor(n/2)-1,t),this.bitmapData.setPixel(n+this.dimension.xAxis-2,this.h-Math.floor(n/2)-1,t);for(s=0;s<this.dimension.xAxis;s+=1)this.bitmapData.setPixel(s,this.h-this.dimension.xAxis/2+Math.floor(s/2),i);for(e=this.dimension.yAxis/2-1;e<this.h-this.dimension.xAxis/2;e+=1)this.bitmapData.setPixel(0,e,i);for(o=0;o<2*this.dimension.xAxis-2;o+=1)this.bitmapData.setPixel(this.dimension.yAxis-1+Math.floor(o/2),o,t),
this.bitmapData.setPixel(1+Math.floor(o/2),this.dimension.yAxis/2+o-1,t);if(this.bitmapData.floodFill(this.dimension.yAxis-2,1,this.color.rightSlope),this.bitmapData.floodFill(this.dimension.xAxis-3,this.h-3,this.color.left),this.bitmapData.setPixel(this.dimension.xAxis-2,this.h-2,this.color.left),this.border)for(a=1;a<2*this.dimension.xAxis-3;a+=1)this.bitmapData.setPixel(1+Math.floor(a/2),this.dimension.yAxis/2+a-1,this.color.borderHighlight)},e.toString=function(){return"[SlopeEast]"},t.exports=n},{"../colors/SlopeColor":6,"../dimensions/SlopeDimension":16,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],34:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/SlopeDimension"),a=i("../colors/SlopeColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive"),m=i("./SideX"),c=i("../dimensions/SideXDimension"),d=i("../colors/SideColor"),x=i("../display/PixelObject");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=3*this.dimension.yAxis/2+this.dimension.xAxis/2,this.w-=2,this.h-=3,this.matrix=new r,this.matrix.tx=-(this.dimension.yAxis-2),this.matrix.ty=-(this.dimension.yAxis-2)},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a,r,l,u;for(i=this.border?this.color.border:this.color.left,t=this.border?this.color.border:this.color.right,s=this.border?this.color.borderHighlight:this.color.left,n=new m(new c(this.dimension.xAxis,this.h-this.dimension.xAxis/2),new d(i,this.color.left)),e=new x(n),o=this.bitmapData.context,o.drawImage(e.canvas,e.x,e.y+this.h-this.dimension.xAxis/2),a=new h(this.w,this.h),r=this.h-3*this.dimension.yAxis/2+2;r<this.h;r+=1)a.setPixel(this.dimension.xAxis-1,r,t);for(l=1;l<this.dimension.yAxis;l+=1)a.setPixel(this.dimension.xAxis+l-2,this.h-Math.floor(l/2)-1,t),a.setPixel(this.dimension.xAxis+l-2,this.dimension.xAxis/2-2+l,t);for(a.floodFill(this.dimension.xAxis+1,this.h-3,this.color.right),u=this.dimension.xAxis/2;u<this.h-1;u+=1)a.setPixel(this.dimension.xAxis-1,u,this.color.right),a.setPixel(this.dimension.xAxis-2,u,s);a.context.putImageData(a.imageData,0,0),o.drawImage(a.canvas,0,0)},e.toString=function(){return"[SlopeNorth]"},t.exports=n},{"../colors/SideColor":5,"../colors/SlopeColor":6,"../dimensions/SideXDimension":14,"../dimensions/SlopeDimension":16,"../display/BitmapData":17,"../display/PixelObject":18,"../geom/Matrix":20,"./AbstractPrimitive":24,"./SideX":31}],35:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/SlopeDimension"),a=i("../colors/SlopeColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=this.dimension.xAxis/2+2*this.dimension.yAxis,this.w-=2,this.h-=3,this.matrix=new r,this.matrix.tx=-(this.dimension.yAxis-2),this.matrix.ty=-(3*this.dimension.yAxis/2-2)},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.bitmapData.context.putImageData(this.bitmapData.imageData,0,0),this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a;for(i=this.border?this.color.border:this.color.leftSlope,t=this.border?this.color.border:this.color.right,n=0;n<this.dimension.xAxis;n+=1)this.bitmapData.setPixel(n,2*this.dimension.yAxis+Math.floor(n/2)-3,i),this.bitmapData.setPixel(n+this.dimension.yAxis-2,Math.floor(n/2),i);for(s=0;s<this.dimension.yAxis;s+=1)this.bitmapData.setPixel(this.dimension.xAxis-2+s,this.h-Math.floor(s/2)-1,t);for(e=this.dimension.xAxis/2-1;e<this.h-this.dimension.yAxis/2;e+=1)this.bitmapData.setPixel(this.w-1,e,t);for(o=0;o<2*this.dimension.yAxis-2;o+=1)this.bitmapData.setPixel(Math.floor(o/2),2*this.dimension.yAxis-o-3,i),this.bitmapData.setPixel(this.dimension.xAxis-2+Math.floor(o/2),this.h-o-1,i);if(this.bitmapData.floodFill(this.dimension.yAxis-1,1,this.color.leftSlope),this.bitmapData.floodFill(this.dimension.xAxis,this.h-3,this.color.right),this.bitmapData.setPixel(this.dimension.xAxis-1,this.h-2,this.color.right),this.border)for(a=1;a<2*this.dimension.yAxis-3;a+=1)this.bitmapData.setPixel(this.dimension.xAxis-2+Math.floor(a/2),this.h-a-1,this.color.borderHighlight)},e.toString=function(){return"[SlopeSouth]"},t.exports=n},{"../colors/SlopeColor":6,"../dimensions/SlopeDimension":16,"../display/BitmapData":17,"../geom/Matrix":20,"./AbstractPrimitive":24}],36:[function(i,t,s){"use strict";var n,e,o=i("../dimensions/SlopeDimension"),a=i("../colors/SlopeColor"),r=i("../geom/Matrix"),h=i("../display/BitmapData"),l=i("./AbstractPrimitive"),m=i("./SideY"),c=i("../dimensions/SideYDimension"),d=i("../colors/SideColor"),x=i("../display/PixelObject");n=function(i,t,s,n){this.initialize(i,t,s,n)},e=n.prototype=new l,e.initialize=function(i,t,s,n){return this.initRender(i,t,s,n),this.initRectangle(),this.initBitmapData(),this.build(),this.renderBitmapDataForCanvas(),this},e.initRender=function(i,t,s,n){this.useDefaultCanvas=n||!1,this.border=s||void 0===s,this.dimension=void 0===i?new o:i,this.color=void 0===t?new a:t},e.initRectangle=function(){this.w=this.dimension.xAxis+this.dimension.yAxis,this.h=3*this.dimension.xAxis/2+this.dimension.yAxis/2,this.w-=2,this.h-=3,this.matrix=new r,this.matrix.tx=-(this.dimension.yAxis-2),this.matrix.ty=-(this.dimension.xAxis-2)},e.initBitmapData=function(){this.bitmapData=new h(this.w,this.h,this.useDefaultCanvas)},e.renderBitmapDataForCanvas=function(){this.canvas=this.bitmapData.canvas},e.build=function(){var i,t,s,n,e,o,a,r,l,u;for(i=this.border?this.color.border:this.color.left,t=this.border?this.color.border:this.color.right,s=this.border?this.color.borderHighlight:this.color.left,n=new m(new c(this.dimension.yAxis,this.h-this.dimension.yAxis/2),new d(t,this.color.right)),e=new x(n),o=this.bitmapData.context,o.drawImage(e.canvas,e.x+this.w-2,e.y+this.h-this.dimension.yAxis/2),a=new h(this.w,this.h),r=this.h-3*this.dimension.xAxis/2+2;r<this.h;r+=1)a.setPixel(this.dimension.xAxis-2,r,i);for(l=0;l<this.dimension.xAxis-1;l+=1)a.setPixel(l,this.dimension.xAxis+this.dimension.yAxis/2-3+Math.floor(l/2),i),a.setPixel(l,this.dimension.xAxis+this.dimension.yAxis/2-3-l,i);for(a.floodFill(this.dimension.xAxis-3,this.h-3,this.color.left),u=this.dimension.yAxis/2;u<this.h-1;u+=1)a.setPixel(this.dimension.xAxis-2,u,s);a.context.putImageData(a.imageData,0,0),o.drawImage(a.canvas,0,0)},e.toString=function(){return"[SlopeWest]"},t.exports=n},{"../colors/SideColor":5,"../colors/SlopeColor":6,"../dimensions/SideYDimension":15,"../dimensions/SlopeDimension":16,"../display/BitmapData":17,"../display/PixelObject":18,"../geom/Matrix":20,"./AbstractPrimitive":24,"./SideY":32}],37:[function(i,t,s){"use strict";var n,e;n=function(){throw new Error("CanvasManager is a static Class, cannot be instanced.")},e=n,e.defaultCanvas=null,e.getDefaultCanvas=function(){return e.defaultCanvas=e.defaultCanvas||document.createElement("canvas"),e.defaultCanvas},e.getNewCanvas=function(){return document.createElement("canvas")},e.toString=function(){return"[CanvasManager]"},t.exports=n},{}],38:[function(i,t,s){"use strict";var n,e;n=function(){throw new Error("CanvasTool is a static Class, cannot be instanced.")},e=n,e.getPixel=function(i,t,s){var n,e,o,a,r;return n=i.data,e=4*(s*i.width+t),o=n[e],a=n[e+1],r=n[e+2],o<<16|a<<8|r},e.toString=function(){return"[CanvasTool]"},t.exports=n},{}],39:[function(i,t,s){"use strict";var n,e;n=function(){throw new Error("ColorGeom is a static Class, cannot be instanced.")},e=n,e.get32=function(i){return 4278190080>i?i+4278190080:i},e.applyBrightness=function(i,t,s){var n,e,o,a,r,h,l;return n=i>>>24&255,e=i>>>16&255,o=i>>>8&255,a=255&i,r=(313524*e>>20)+(615514*o>>20)+(119538*a>>20),l=-(155189*e>>20)-(303038*o>>20)+(458227*a>>20),h=(644874*e>>20)-(540016*o>>20)-(104857*a>>20),s?r=60+Math.pow(r,1.2):r+=t,e=r+(1195376*h>>20),o=r-(408944*l>>20)-(608174*h>>20),a=r+(2128609*l>>20),e=Math.max(0,Math.min(e,255)),o=Math.max(0,Math.min(o,255)),a=Math.max(0,Math.min(a,255)),n<<24|e<<16|o<<8|a},e.toString=function(){return"[ColorGeom]"},t.exports=n},{}],40:[function(i,t,s){"use strict";var n,e;n=function(){throw new Error("ColorPattern is a static Class, cannot be instanced.")},e=n,e.GRASS_GREEN=13434624,e.YELLOW=16776960,e.WINE_RED=16711833,e.PINK=16743615,e.PURPLE=13369599,e.BLUE=52479,e.GRAY=15658734,e.BLACK=6710886,e.FINE_COLORS=[e.GRASS_GREEN,e.YELLOW,e.WINE_RED,e.PINK,e.PURPLE,e.BLUE,e.GRAY,e.BLACK],e.getRandomComfortableColor=function(){return e.FINE_COLORS[Math.floor(Math.random()*e.FINE_COLORS.length)]},e.toString=function(){return"[ColorPattern]"},t.exports=n},{}]},{},[23]);

/*
 * George G. Gkasdrogkas - georgegkas@gmail.com
 * Version: 1.1.0 (currently stable), 7/6/2016 
 * Project Page: https://github.com/GeorgeGks/isometricObelisk.js
 * Documentation Page: https://github.com/GeorgeGks/isometricObelisk.js/wiki
 *
 */

var isometricObelisk=function(){var v,w,x,t;function e(a){v=document.getElementById(a.canvasId);w=a.PointX;x=a.PointY;a=new obelisk.Point(w,x);t=new obelisk.PixelView(v,a)}function u(a){return"#"==a[0]&&a?parseInt("0x"+a.substr(1,6).toString(16),16):15658734}v=null;x=w=200;var b=t=null,B=null,y=0,z=0,A=0,c=null,h=80,m=80,C=80,k=!0,d=null,f="full",l=15658734,g=15658734,n=15658734,q=15658734,r=function(a,b){return b.hasOwnProperty(a)&&0!==b[a].length?!0:!1},p=function(a){a&&(r("x",a)&&(h=a.x),r("y",
a)&&(m=a.y),r("z",a)&&(C=a.z),r("border",a)&&(k=a.border))};e.prototype.cube=function(a){b="cube";p(a);c=new obelisk.CubeDimension(h,m,C);return this};e.prototype.brick=function(a){b="brick";p(a);c=new obelisk.BrickDimension(h,m);return this};e.prototype.pyramid=function(a){a=void 0===a?{}:a;b="pyramid";p(a);c=a.hasOwnProperty("z")&&a.z?new obelisk.PyramidDimension(h,a.z):new obelisk.PyramidDimension(h);return this};e.prototype.sideX=function(a){b="sideX";p(a);c=new obelisk.SideXDimension(h,m);return this};
e.prototype.sideY=function(a){b="sideY";p(a);c=new obelisk.SideYDimension(h,m);return this};e.prototype.slopeNorth=function(a){b="slopeNorth";p(a);c=new obelisk.SlopeDimension(h,m);return this};e.prototype.slopeEast=function(a){b="slopeEast";p(a);c=new obelisk.SlopeDimension(h,m);return this};e.prototype.slopeSouth=function(a){b="slopeSouth";p(a);c=new obelisk.SlopeDimension(h,m);return this};e.prototype.slopeWest=function(a){b="slopeWest";p(a);c=new obelisk.SlopeDimension(h,m);return this};e.prototype.position=
function(a){void 0!=a?(y=a.x,z=a.y,A=a.z):(y=200,z=120,A=0);B=new obelisk.Point3D(y,z,A);return this};e.prototype.color=function(a,c){f="full";f=g=l=15658734;0<arguments.length&&("custom"!=a?(f="full",l=u(a)):void 0!=c&&(f="side",r("top",c)&&(g=u(c.top)),r("side",c)&&(n=u(c.side)),r("front",c)&&(q=u(c.front))));"cube"==b?d="full"==f?(new obelisk.CubeColor).getByHorizontalColor(l):new obelisk.CubeColor(1996488704,1996488704,q,n,g):"pyramid"==b?d="full"==f?(new obelisk.PyramidColor).getByRightColor(l):
new obelisk.PyramidColor(g,g,q,n):"sideX"==b||"sideY"==b?d="full"==f?(new obelisk.SideColor).getByInnerColor(l):new obelisk.SideColor(n,q):"brick"==b?d="full"==f?(new obelisk.SideColor).getByInnerColor(l):new obelisk.SideColor(n,g):"slopeNorth"==b?d="full"==f?(new obelisk.SlopeColor).getByHorizontalColor(l):new obelisk.SlopeColor(g,g,n,q):"slopeEast"==b?d="full"==f?(new obelisk.SlopeColor).getByHorizontalColor(l):new obelisk.SlopeColor(q,1996488704,n,1996488704):"slopeSouth"==b?d="full"==f?(new obelisk.SlopeColor).getByHorizontalColor(l):
new obelisk.SlopeColor(g,g,1996488704,q,n):"slopeWest"==b&&(d="full"==f?(new obelisk.SlopeColor).getByHorizontalColor(l):new obelisk.SlopeColor(g,g,n,q));return this};e.prototype.render=function(){var a=null;"cube"==b?a=new obelisk.Cube(c,d,k):"brick"==b?a=new obelisk.Brick(c,d,k):"pyramid"==b?a=new obelisk.Pyramid(c,d,k):"sideX"==b?a=new obelisk.SideX(c,d,k):"sideY"==b?a=new obelisk.SideY(c,d,k):"slopeNorth"==b?a=new obelisk.SlopeNorth(c,d,k):"slopeEast"==b?a=new obelisk.SlopeEast(c,d,k):"slopeSouth"==
b?a=new obelisk.SlopeSouth(c,d,k):"slopeWest"==b&&(a=new obelisk.SlopeWest(c,d,k));t.renderObject(a,B);return this};e.prototype.clear=function(){t.clear()};return e}();

var gameProperties = {};

gameProperties.general = {
  zIndex: 40,
  zIndexStep: 40,
  cubeDimension: {
    x: 150,
    y: 150,
    z: 40
  },
  dx: 10,
  dy: 10,
  isLeftCubeTurn: true,
  revealBorder: true,
  cubesInStack: 1,
  maxCubeToPlace: 10
};

gameProperties.leftCubePosition = {
  endPoint: {
    x: 200,
    y: 0
  },
  currentPoint: {
    x: -550,
    y: 0
  }
};

gameProperties.rightCubePosition = {
  endPoint: {
    x: 0,
    y: 200
  },
  currentPoint: {
    x: 0,
    y: -600
  }
};

function MoveLeftCube() {
  if (gameProperties.leftCubePosition.currentPoint.x < 0) {
    gameProperties.leftCubePosition.currentPoint.x += gameProperties.general.dx;
  } else {
    gameProperties.general.zIndex += gameProperties.general.zIndexStep;
    gameProperties.general.cubesInStack++;
    gameProperties.general.isLeftCubeTurn = false;
    gameProperties.leftCubePosition.currentPoint.x = -550;
    gameProperties.leftCubePosition.currentPoint.y = 0;
  }
}

function MoveRightCube() {
  if (gameProperties.rightCubePosition.currentPoint.y < 0) {
    gameProperties.rightCubePosition.currentPoint.y += gameProperties.general.dy;
  } else {
    gameProperties.general.zIndex += gameProperties.general.zIndexStep;
    gameProperties.general.cubesInStack++;
    gameProperties.general.isLeftCubeTurn = true;
    gameProperties.rightCubePosition.currentPoint.y = -600;
    gameProperties.rightCubePosition.currentPoint.x = 0;
  }
}

function update() {
  initializeCubes();
  if (gameProperties.general.isLeftCubeTurn) {
    _isometric.cube({
      x: gameProperties.general.cubeDimension.x,
      y: gameProperties.general.cubeDimension.y,
      z: gameProperties.general.cubeDimension.z,
      border: gameProperties.general.revealBorder
    }).position({
      x: gameProperties.leftCubePosition.currentPoint.x,
      y: gameProperties.leftCubePosition.currentPoint.y,
      z: gameProperties.general.zIndex
    }).color('#000000').render();

    MoveLeftCube();

  } else {
    _isometric.cube({
      x: gameProperties.general.cubeDimension.x,
      y: gameProperties.general.cubeDimension.y,
      z: gameProperties.general.cubeDimension.z,
      border: gameProperties.general.revealBorder
    }).position({
      x: gameProperties.rightCubePosition.currentPoint.x,
      y: gameProperties.rightCubePosition.currentPoint.y,
      z: gameProperties.general.zIndex
    }).color('#000000').render();

    MoveRightCube();
  }

  if (gameProperties.general.cubesInStack == gameProperties.general.maxCubeToPlace) {
    clearInterval(_timer);
    initializeCubes();
  }
}

function initializeCubes() {
  var z = 0;
  _isometric.clear();
  for (var i = 0; i < gameProperties.general.cubesInStack; ++i) {
    _isometric.cube({
      x: gameProperties.general.cubeDimension.x,
      y: gameProperties.general.cubeDimension.y,
      z: gameProperties.general.cubeDimension.z,
      border: gameProperties.general.revealBorder
    }).position({
      z: z
    }).color().render();
    z += gameProperties.general.zIndexStep;
  }
}

var _isometric = new isometricObelisk({
  canvasId: 'world',
  PointX: 380,
  PointY: 430
});

var _timer = setInterval(update, 100);

Comments