namespace UnityEngine.UI.Extensions.Examples { public class Example01ScrollViewCell : FancyScrollViewCell { [SerializeField] Animator animator; [SerializeField] Text message; readonly int scrollTriggerHash = Animator.StringToHash("scroll"); void Start() { var rectTransform = transform as RectTransform; rectTransform.anchorMax = Vector2.one; rectTransform.anchorMin = Vector2.zero; rectTransform.anchoredPosition3D = Vector3.zero; UpdatePosition(0); } /// /// セルの内容を更新します /// /// public override void UpdateContent(Example01CellDto itemData) { message.text = itemData.Message; } /// /// セルの位置を更新します /// /// public override void UpdatePosition(float position) { animator.Play(scrollTriggerHash, -1, position); animator.speed = 0; } } }