Author Topic: How to make this scrollview?  (Read 1952 times)

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
How to make this scrollview?
« on: November 19, 2014, 01:18:20 AM »
Hi.

See this video,

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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make this scrollview?
« Reply #1 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.

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: How to make this scrollview?
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make this scrollview?
« Reply #3 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.