UNPKG

@smoud/tiny

Version:

Fast and tiny JavaScript library for HTML5 game and playable ads creation.

1 lines 2.19 kB
!function(){var e={700:function(){Tiny.Object2D.prototype.removeChildren=function(e,t){var r=e||0,n='number'==typeof t?t:this.children.length,i=n-r;if(i>0&&i<=n){for(var a=this.children.splice(r,i),s=0;s<a.length;s++){a[s].parent=void 0}return a}if(0===i&&0===this.children.length)return[];throw new Error('removeChildren: Range Error, numeric values are outside the acceptable range')}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}!function(){"use strict";var e=function(e){var t=new Tiny.CanvasBuffer(1,1),r=t.context;r.fillStyle=e.color||'#000000',r.rect(0,0,1e3,1e3),r.fill(),Tiny.Sprite.call(this,new Tiny.Texture(t.canvas));var n=this.game=e.game;this.visible=!0,this._bounds=new Tiny.Rectangle(0,0,1,1),this.alpha=e.alpha||.5,!1!==e.input&&n.input.add(this,{transparent:e.transparent})};e.prototype=Object.assign(Object.create(Tiny.Sprite.prototype),{constructor:e,updateTransform:function(){var e=this.worldTransform;e.a=this.game.width,e.d=this.game.height,this.worldAlpha=this.alpha},getBounds:function(){return this._bounds.width=this.game.width,this._bounds.height=this.game.height,this._bounds}}),Object.defineProperty(e.prototype,'worldVisible',{get:function(){return this.visible}});var t=function(){Tiny.Object2D.call(this)};(t.prototype=Object.create(Tiny.Object2D.prototype)).constructor=t;var n=function(){};t.prototype.addChildAt=function(e,t){if(t>=0&&t<=this.children.length)return e._RenderLayer_render=e.render,e.render=n,this.children.splice(t,0,e),e;throw new Error(e+'addChildAt: The index '+t+' supplied is out of bounds '+this.children.length)},t.prototype.removeChildAt=function(e){var t=this.getChildAt(e);return this.children.splice(e,1),t.render=t._RenderLayer_render,t._RenderLayer_render=null,t},t.prototype.updateTransform=function(){},t.prototype.renderCanvas=function(e){if(!1!==this.visible&&0!==this.alpha)if(this._cacheAsBitmap)this._renderCachedSprite(e);else{this._mask&&e.maskManager.pushMask(this._mask,e);for(var t=0;t<this.children.length;t++)this.children[t]._RenderLayer_render(e);this._mask&&e.maskManager.popMask(e)}};r(700);Tiny.Opaque=e,Tiny.RenderLayer=t}()}();