var CanvasMX = (function(){ function CanvasMX (w, h) { w = w || 100 h = h || 100 var canvas = this.canvas = document.createElement("canvas") canvas.width = w canvas.height = h this.ctx = canvas.getContext('2d') var mx = this.mx = new MX.Object3D () this.el = mx.el mx.el.appendChild(canvas) scene.add(mx) } CanvasMX.prototype.resize = function(w, h){ this.canvas.width = w this.canvas.height = h this.mx.width = w this.mx.height = h } CanvasMX.prototype.clear = function(){ this.snap.clear() } CanvasMX.prototype.show = function(){ this.visible = true this.mx.style.display = "block" } CanvasMX.prototype.hide = function(){ this.visible = false this.mx.style.display = "hide" } return CanvasMX })()