UNPKG

@smoud/tiny

Version:

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

1 lines 651 B
!function(){"use strict";var e={spritesheet:function(e){for(var n,t,r,a,i,o,s=e.resolution||1,h=s*e.width|0,u=s*e.height|0,T=e.frames,c=e.key,d=T-1,f=h*e.frames,w=new Tiny.CanvasBuffer(f,u),y=new Tiny.BaseTexture(w.canvas),l={context:o=w.context,currentBlendMode:0,resolution:s},x=0;x<T;x++){if(r=new Tiny.Rectangle(h*x,0,h,u),a=e.draw((x+1)/T,o,r)){(i=a.worldTransform).tx=e.width*x+e.width/2,i.ty=e.height/2,a.worldAlpha=1;for(var v=a.children,m=0,C=v.length;m<C;m++)v[m].updateTransform();a.renderCanvas(l)}n=c+'.'+x,(t=new Tiny.Texture(y,r)).key=c,t.lastFrame=d,Tiny.Cache.texture[n]=t}Tiny.Cache.texture[c]=new Tiny.Texture(y)}};Tiny.Create=e}();