Esempio n. 1
0
    public static IEnumerator BackEaseSlideInX(RectTransform rt, float targetPosition, float animationTime)
    {
        float elapsedTime   = 0;
        float startPosition = rt.anchoredPosition.x;

        while (elapsedTime < animationTime)
        {
            rt.anchoredPosition = new Vector2(
                PennerAnimation.BackEaseInOut(elapsedTime, startPosition, targetPosition - startPosition, animationTime),
                rt.anchoredPosition.y
                );
            elapsedTime += Time.deltaTime;
            yield return(0);
        }
        rt.anchoredPosition = new Vector2(
            targetPosition,
            rt.anchoredPosition.y
            );
    }
Esempio n. 2
0
    public static IEnumerator BackEaseSlideInY(Transform t, float targetPosition, float animationTime)
    {
        float elapsedTime   = 0;
        float startPosition = t.localPosition.y;

        while (elapsedTime < animationTime)
        {
            t.localPosition = new Vector2(
                t.localPosition.x,
                PennerAnimation.BackEaseInOut(elapsedTime, startPosition, targetPosition - startPosition, animationTime)
                );
            elapsedTime += Time.deltaTime;
            yield return(0);
        }
        t.localPosition = new Vector2(
            t.localPosition.x,
            targetPosition
            );
    }