So I’m working on infinite scroll view and I’d like to add auto scroll effect when entering the scene. Something like this: - Find & Share on GIPHY All the movement I made with the mouse.
How can I achieve this effect? I tried to get this effect with this:
public IEnumerator AutoScroll(ScrollRect scrollRect, float startPos, float endPos, float duration)
{
yield return new WaitForSeconds(5f);
float t0 = 0.0f;
while (t0 < 1.0f)
{
t0 += Time.deltaTime / duration;
scrollRect.horizontalNormalizedPosition = Mathf.Lerp(startPos, endPos, t0);
yield return null;
}
}
And with this:
scrollRect.normalizedPosition = new Vector2(0, 1);
but this only works if its normal scroll rect, not infinite. Any ideas on how can I achieve this effect? Thanks!