Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: jd3d on June 02, 2015, 06:37:10 PM

Title: Scaling Sliced Sprite is giving a weird result
Post by: jd3d on June 02, 2015, 06:37:10 PM
I am using a 510x510 sliced sprite as the border for all different sizes of buttons and general hud borders. The issue is sometimes I cannot shrink the to the appropriate size I want without applying a transform scale to shrink the border sprite. It works overall but usually this border is the child of my button and if I want to resize the overall button, the border sprite moves with unexpecting results and generally gets itself offset from my button. Also, telling it to anchor to the above button, it rescales itself and messes up the look. I am guessing that the math being applied to the moving it is off as the local scale values are not 1 to 1 anymore. Is there any proper way to do this, or do I need multiple sized sprites for the different border sizes I need?
Title: Re: Scaling Sliced Sprite is giving a weird result
Post by: Razhagal on June 03, 2015, 05:31:12 AM
The middle part of the slicing is the one that actually stretches/shrinks. The smaller it is the less you can shrink the sprite. For example for your 510x510 sprite if you slice it with 200px on all sides you wont be able to shrink it more than 100px than the original size. It mostly depends on the sprite you're using. If it rich on some patterns and other stuff then its hard to find the best slice (if it exists). But if its the same you can easily just slice it around the corners just to keep their roundness and stretch the middle part.
Title: Re: Scaling Sliced Sprite is giving a weird result
Post by: jd3d on June 03, 2015, 12:39:59 PM
I should clarify by shrinking I don't mean the normal effect you get with a sliced sprites, I mean making the borders themselves tinier so I can fit it into a smaller space on my GUI. I can do that with scaling the sprite's transform down. But this gives me the issues mentioned above.
Title: Re: Scaling Sliced Sprite is giving a weird result
Post by: ArenMook on June 07, 2015, 12:31:28 PM
NGUI 3's anchoring system is designed with widget scales of (1, 1, 1) in mind. If you want a smaller border, then the obvious thing to do would be to edit the original texture in Photoshop to make it smaller.