void LateUpdate() { mLoopListView.UpdateAllShownItemSnapData(); int count = mLoopListView.ShownItemCount; for (int i = 0; i < count; ++i) { LoopListViewItem item = mLoopListView.GetShownItemByIndex(i); ListItem itemScript = item.GetComponent <ListItem>(); float scale = 1 - Mathf.Abs(item.DistanceWithViewPortSnapCenter) / 700f; scale = Mathf.Clamp(scale, 0.4f, 1); itemScript.mContentRootObj.GetComponent <CanvasGroup>().alpha = scale; itemScript.mContentRootObj.transform.localScale = new Vector3(scale, scale, 1); } }
void LateUpdate() { m_Looplistview.UpdateAllShownItemSnapData(); //切换缩放效果 int tmp_Count = m_Looplistview.ShownItemCount; for (int i = 0; i < tmp_Count; ++i) { LoopListViewItem tmp_Item = m_Looplistview.GetShownItemByIndex(i); ListItem tmp_Itemscript = tmp_Item.GetComponent <ListItem>(); float tmp_Scale = 1 - Mathf.Abs(tmp_Item.DistanceWithViewPortSnapCenter) / 700f; tmp_Scale = Mathf.Clamp(tmp_Scale, 0.8f, 1); tmp_Itemscript.m_Contentrootobj.GetComponent <CanvasGroup>().alpha = tmp_Scale; tmp_Itemscript.m_Contentrootobj.transform.localScale = new Vector3(tmp_Scale, tmp_Scale, 1); } }