Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int scrollRectChildrenCount = scrollRect.content.childCount;
- float currentViewIndex = scrollRect.normalizedPosition.x * (scrollRect.content.childCount - 1);
- int currentChildIndex = 0;
- foreach (Transform child in scrollRect.content)
- {
- float childScale = Mathf.Lerp(m_minElementScale, m_maxElementScale, Mathf.Clamp01(1.0f - Mathf.Abs(currentViewIndex - (float)currentChildIndex) / m_scaleDistance));
- child.localScale = new Vector3(childScale, childScale, childScale);
- currentChildIndex++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement