Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: leegod on November 19, 2014, 01:18:20 AM

Title: How to make this scrollview?
Post by: leegod on November 19, 2014, 01:18:20 AM
Hi.

See this video,

http://www.youtube.com/watch?v=sfYnZ40QUeU&feature=youtu.be (http://www.youtube.com/watch?v=sfYnZ40QUeU&feature=youtu.be)

at 00:49 ~ 00:51 of above video, you can see cards scrolling and when some card positioned at left part of scrollview, it becomes bigger and user can see as large card.

and then it again become small size when scrolling to end of screen.


I don't know this game used NGUI solution, but I want to know how to make card scroll system like that by NGUI.

Thanks.
Title: Re: How to make this scrollview?
Post by: ArenMook on November 19, 2014, 03:46:43 PM
Making something inside your scroll view bigger or smaller based on its position is a trivial task. Calculate the center of the scroll view (or the left hand side, whatever you need). Ideally assuming you have an invisible UIWidget background covering it, it would be a simple matter of checking its worldCorners (or localCorners if you prefer). Now knowing the position of your items, figure out which one is closest to the position of your choice and enlarge it by adjusting its transform scale.
Title: Re: How to make this scrollview?
Post by: leegod on November 21, 2014, 08:57:35 PM
Thx for reply.

But how adjust distance between cards automatically if one card's size become bigger?

Bigger card will hide its side cards.
Title: Re: How to make this scrollview?
Post by: ArenMook on November 21, 2014, 09:13:19 PM
Same exactly way. It would be your code. Based on the calculated value of the card's position to the center of the scroll view (or left side, whatever), adjust its scale and position accordingly.