Nine-Slice
🧪 Available in the v0.30.0 Alpha
Overview​
The NineSlice is a Graphic which uses a 2D technique allowing for reuse of an image at various sizes without needing to prepare multiple assets. The process includes taking an input sprite texture, and splitting it into 9 sections, which then can be repainted in a new sprite texture without scaling or distorting the texture. This is very useful in game development for UI panels or buttons or textured platforms.
For example: let's say this is your source texture sprite.
The nine slice Graphic will break that texture up into 9 separate parts.
Then based on your output parameters specified it will 'redraw' this texture to whatever specified output graphic you want.
You can set parameters under sourceConfig
properties to control the margins. This lets you dial in where the module 'slices' your texture up. For example, with the example 64 pixel x 64 pixel sprite, we can set the top/bottom margins to 5 pixels, and the left/right margins to 6 pixels to get this slicing.