Example #1
0
    private IEnumerator tweenLocalPositionY_cr(float start, float end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback = null)
    {
        this.transform.SetLocalPosition(null, start, null);
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            this.transform.SetLocalPosition(null, EaseUtils.Ease(ease, start, end, val), null);
            if (updateCallback != null)
            {
                updateCallback(val);
            }
            float num = t + this.LocalDeltaTime;
            yield return(null);
        }
        this.transform.SetLocalPosition(null, end, null);
        if (updateCallback != null)
        {
            updateCallback(1f);
        }
        yield return(null);

        /*Error: Unable to find new state assignment for yield return*/
        ;
    }
Example #2
0
    // public static void SetAlpha (this tk2dTextMesh self, float alpha) {
    //  Color next = self.color;
    //  next.a = Mathf.Clamp01 ( alpha );
    //  self.color = next;
    // }

    public static Color ColorTranslate(Color a, Color b, EaseUtils.EaseType easeType, float t)
    {
        Color ret = a;

        ret.r = EaseUtils.Ease(easeType, a.r, b.r, t);
        ret.g = EaseUtils.Ease(easeType, a.g, b.g, t);
        ret.b = EaseUtils.Ease(easeType, a.b, b.b, t);
        ret.a = EaseUtils.Ease(easeType, a.a, b.a, t);
        return(ret);
    }
Example #3
0
    protected IEnumerator tweenValue_cr(float start, float end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback)
    {
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            updateCallback?.Invoke(EaseUtils.Ease(ease, start, end, val));
            t += this.LocalDeltaTime;
            yield return(null);
        }
        updateCallback?.Invoke(end);
        yield return(null);
    }
Example #4
0
    private IEnumerator goTo_cr(float start, float end, float time, EaseUtils.EaseType ease)
    {
        float t = 0f;

        base.transform.SetLocalPosition(null, start, null);
        while (t < time)
        {
            float val = t / time;
            base.transform.SetLocalPosition(null, EaseUtils.Ease(ease, start, end, val), null);
            t += CupheadTime.GlobalDelta;
            yield return(StartCoroutine(base.WaitForPause_CR()));
        }
        base.transform.SetLocalPosition(null, end, null);
    }
Example #5
0
    static public IEnumerator TweenValue_cr(float start, float end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback, TweenCompletedHandler endCallback = null)
    {
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            updateCallback?.Invoke(EaseUtils.Ease(ease, start, end, val));
            t += CupheadTime.GlobalDelta;
            yield return(null);
        }
        updateCallback?.Invoke(end);
        endCallback?.Invoke();
        yield return(null);
    }
Example #6
0
    private IEnumerator tweenPosition_cr(Vector2 start, Vector2 end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback = null)
    {
        this.transform.position = start;
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            float x   = EaseUtils.Ease(ease, start.x, end.x, val);
            float y   = EaseUtils.Ease(ease, start.y, end.y, val);
            this.transform.SetPosition(x, y, 0f);
            updateCallback?.Invoke(val);
            t += this.LocalDeltaTime;
            yield return(null);
        }
        this.transform.position = end;
        updateCallback?.Invoke(1f);
        yield return(null);
    }
Example #7
0
    private IEnumerator tweenLocalRotation2D_cr(float start, float end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback = null)
    {
        this.transform.SetLocalEulerAngles(null, null, start);
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            this.transform.SetLocalEulerAngles(null, null, EaseUtils.Ease(ease, start, end, val));
            if (updateCallback != null)
            {
                updateCallback(val);
            }
            float num = t + this.LocalDeltaTime;
            yield return(null);
        }
        this.transform.SetLocalEulerAngles(null, null, end);
        if (updateCallback != null)
        {
            updateCallback(1f);
        }
        yield return(null);
    }
Example #8
0
 public Coroutine TweenLocalRotation2D(float start, float end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback)
 {
     return(base.StartCoroutine(this.tweenLocalRotation2D_cr(start, end, time, ease, updateCallback)));
 }
Example #9
0
 public Coroutine TweenLocalRotation2D(float start, float end, float time, EaseUtils.EaseType ease)
 {
     return(base.StartCoroutine(this.tweenLocalRotation2D_cr(start, end, time, ease, null)));
 }
Example #10
0
 public Coroutine TweenPositionZ(float start, float end, float time, EaseUtils.EaseType ease)
 {
     return(base.StartCoroutine(this.tweenPositionZ_cr(start, end, time, ease, null)));
 }
Example #11
0
    static public IEnumerator TweenLocalPosition_cr(Transform target, Vector3 start, Vector3 end, float time, EaseUtils.EaseType ease, CupheadTime.Layer timeLayer, TweenUpdateHandler updateCallback, TweenCompletedHandler endCallback = null)
    {
        target.localPosition = start;
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            float x   = EaseUtils.Ease(ease, start.x, end.x, val);
            float y   = EaseUtils.Ease(ease, start.y, end.y, val);
            float z   = EaseUtils.Ease(ease, start.z, end.z, val);
            target.SetLocalPosition(x, y, z);
            updateCallback?.Invoke(val);
            t += CupheadTime.Delta[timeLayer];
            yield return(null);
        }
        target.localPosition = end;
        updateCallback?.Invoke(1f);
        endCallback?.Invoke();
        yield return(null);
    }
Example #12
0
 public Coroutine TweenLocalPosition(Vector2 start, Vector2 end, float time, EaseUtils.EaseType ease, TweenUpdateHandler updateCallback)
 {
     return(base.StartCoroutine(this.tweenLocalPosition_cr(start, end, time, ease, updateCallback)));
 }
Example #13
0
 public Coroutine TweenLocalPosition(Vector2 start, Vector2 end, float time, EaseUtils.EaseType ease)
 {
     return(base.StartCoroutine(this.tweenLocalPosition_cr(start, end, time, ease, null)));
 }
Example #14
0
    static public IEnumerator TweenPosition_cr(Transform target, Vector3 start, Vector3 end, float time, EaseUtils.EaseType ease)
    {
        target.position = start;
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            float x   = EaseUtils.Ease(ease, start.x, end.x, val);
            float y   = EaseUtils.Ease(ease, start.y, end.y, val);
            float z   = EaseUtils.Ease(ease, start.z, end.z, val);
            target.SetPosition(x, y, z);
            t += CupheadTime.GlobalDelta;
            yield return(null);
        }
        target.position = end;
        yield return(null);
    }
Example #15
0
    static public IEnumerator TweenScale_cr(Transform transform, Vector2 start, Vector2 end, float time, EaseUtils.EaseType ease, CupheadTime.Layer timeLayer, TweenCompletedHandler endCallback = null)
    {
        transform.SetScale(start.x, start.y, null);
        float t = 0f;

        while (t < time)
        {
            float val = t / time;
            float x   = EaseUtils.Ease(ease, start.x, end.x, val);
            float y   = EaseUtils.Ease(ease, start.y, end.y, val);
            transform.SetScale(x, y, null);
            t += CupheadTime.Delta[timeLayer];
            yield return(null);
        }
        transform.SetScale(end.x, end.y, null);
        endCallback?.Invoke();
        yield return(null);
    }
Example #16
0
    static public IEnumerator TweenSpriteRendererColor_cr(SpriteRenderer renderer, Color start, Color end, float time, EaseUtils.EaseType ease, CupheadTime.Layer timeLayer, TweenCompletedHandler endCallback = null)
    {
        float t = 0f;
        Color c = start;

        while (t < time)
        {
            float val = t / time;

            c.r = EaseUtils.Ease(ease, start.r, end.r, val);
            c.g = EaseUtils.Ease(ease, start.g, end.g, val);
            c.b = EaseUtils.Ease(ease, start.b, end.b, val);
            c.a = EaseUtils.Ease(ease, start.a, end.a, val);

            renderer.color = c;

            t += CupheadTime.Delta[timeLayer];
            yield return(null);
        }
        endCallback?.Invoke();
        yield return(null);
    }