Author Topic: Is possible to simply make scroll-item scaling while scrollview move?  (Read 5517 times)

RiRin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
I want all items in scrollview scaling like a wave.
The center item will be the one that its size is the biggest.
I wonder that if it is possible to do with what NGUI provide to achieve what I want.

Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Is possible to simply make scroll-item scaling while scrollview move?
« Reply #1 on: November 08, 2012, 02:03:18 PM »
Create a script that will reference your clipped panel and attach it to all of your items. Inside the script check the distance to the clipped center and set the scale accordingly.

RiRin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Is possible to simply make scroll-item scaling while scrollview move?
« Reply #2 on: November 09, 2012, 01:12:13 PM »
Create a script that will reference your clipped panel and attach it to all of your items. Inside the script check the distance to the clipped center and set the scale accordingly.

Thank you for your reply.
I am not  sure about clipped center stuff.
I have tried but it did not work.
So confusing....
I want to make it move like a wave.
  1. void Update () {
  2.                 //I put UIDraggableContent objects in the list. The center object's scale must be 1 (biggest)
  3.                 for(int i=0; i<list.Count; i++)
  4.                 {
  5.                         var position = list[i].transform.localPosition;
  6.                         var center = list[i].GetComponent<UIDragPanelContents>().draggablePanel.panel.clipRange.x;
  7.                         var diff = Mathf.Abs(position.x - center);
  8.                         var scale = diff/center;
  9.                         list[i].transform.localScale = new Vector3(scale,scale,1);
  10.                        
  11.                 }
  12.        
  13.         }
  14.  

the thing that I got was the object sizes were bigger respectively.
I wonder if it possible for object to overlap when scroll the panel. (<-- that is also what I want)
When the objects were scaling, the space between them were still same.
Is it possible to change space dynamically?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Is possible to simply make scroll-item scaling while scrollview move?
« Reply #3 on: November 09, 2012, 05:40:37 PM »
clipRange is in local position values, and you still need to add it to the panel transform's local position to get the real value.

x5Armie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Is possible to simply make scroll-item scaling while scrollview move?
« Reply #4 on: April 15, 2013, 01:08:05 AM »
Hi Guys,

I'm trying to make a scrollable items list which scales items at run-time. The leftmost item is the currently selected one and that needs to be scaled up slightly more than the others. I've tried to change the local scales of all items but somehow they only change when I stop the dragging. Is it possible for the scale change to happen as I drag ?

x5Armie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Is possible to simply make scroll-item scaling while scrollview move?
« Reply #5 on: April 16, 2013, 11:54:57 PM »
Nevermind, I found the problem. My panel was set as static which wasn't letting the items scale up.