Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ferretnt on October 14, 2012, 08:10:01 PM

Title: Drawing subregions of a sprite.
Post by: ferretnt on October 14, 2012, 08:10:01 PM
Is there a way to tell a sprite to draw a dynamically selected subregion of itself, e.g. for revealing a sprite in a top-down manner?

For example, suppose that I have a 64x64 sprite, and in frame n, I want to draw a 64xn subregion of the sprite, with both vertex positions and UVs forming a rectange from (0, 0) to (64, n) , so that the sprite reveals from the top down? This obviously can't be done with just a scale because I want the same screen pixel of the sprite to always correspond to the same texel.

Is there an easy way to do this in NGUI?

Thanks,
Alex
Title: Re: Drawing subregions of a sprite.
Post by: ArenMook on October 15, 2012, 06:29:52 AM
Sure. Use a Filled Sprite with a Vertical fill.
Title: Re: Drawing subregions of a sprite.
Post by: ferretnt on October 15, 2012, 10:16:16 AM
Yes, exactly like that. Thanks!