Been trying to figure out best way to handle this and tbh the documentation is very limited on explanation of the api.
What I am trying to do is display a segment of a sprite. I have decided to do my own clipping as using the stencil clipping is very processor expensive and does not work on some browsers.
If I have a sprite which is 128x128 in size. I am displaying it at coords 100x100. I am adding a scale onto this sprite which is desiredSize/spriteSize. Now I want to…for example.. say ok the sprite is half over my clipping boundary.. eg..
------| sprite |-------
| |--------| |
What is the best way to achieve this with the sprite api?
I have tested using _setTextureCoords to specify the segment of the sprite I want.
Adjusted the new coords of the sprite
And then tried using scale etc to get a result of only the bottom half of the sprite appearing but I am getting strange results.
Is there any method to specify to the sprite that I only want to occupy x,y,w,h area of the screen?
As I said the API is very limited in documentation and I have scanned through the Sprite js code but I cannot figure the best approach for this.