Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. int scrollRectChildrenCount = scrollRect.content.childCount;
  2.         float currentViewIndex = scrollRect.normalizedPosition.x * (scrollRect.content.childCount - 1);
  3.  
  4.         int currentChildIndex = 0;
  5.         foreach (Transform child in scrollRect.content)
  6.         {
  7.             float childScale = Mathf.Lerp(m_minElementScale, m_maxElementScale, Mathf.Clamp01(1.0f - Mathf.Abs(currentViewIndex - (float)currentChildIndex) / m_scaleDistance));
  8.             child.localScale = new Vector3(childScale, childScale, childScale);
  9.             currentChildIndex++;
  10.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement