Beispiel #1
0
        private void RefreshContinued()
        {
            if (thisImage)
            {
                normalColor = thisImage.color;
            }

            if (highlightWhen != HighlightActive.Never)
            {
                highlightColor = rippleColor;

                HSBColor highlightColorHSB = HSBColor.FromColor(highlightColor);
                HSBColor normalColorHSB    = HSBColor.FromColor(normalColor);

                if (highlightColorHSB.s <= 0.05f)
                {
                    if (highlightColorHSB.b > 0.5f)
                    {
                        if (normalColorHSB.b > 0.9f)
                        {
                            highlightColorHSB.h = normalColorHSB.h;
                            highlightColorHSB.s = normalColorHSB.s - 0.1f;
                            highlightColorHSB.b = normalColorHSB.b + 0.2f;
                        }
                        else
                        {
                            highlightColorHSB.h = normalColorHSB.h;
                            highlightColorHSB.s = normalColorHSB.s;
                            highlightColorHSB.b = normalColorHSB.b + 0.2f;
                        }
                    }
                    else
                    {
                        highlightColorHSB.h = normalColorHSB.h;
                        highlightColorHSB.s = normalColorHSB.s;
                        highlightColorHSB.b = normalColorHSB.b - 0.15f;
                    }

                    highlightColor   = HSBColor.ToColor(highlightColorHSB);
                    highlightColor.a = normalColor.a;
                }
                else
                {
                    highlightColor.r = Anim.Linear(normalColor.r, highlightColor.r, 0.2f, 1f);
                    highlightColor.g = Anim.Linear(normalColor.g, highlightColor.g, 0.2f, 1f);
                    highlightColor.b = Anim.Linear(normalColor.b, highlightColor.b, 0.2f, 1f);
                    highlightColor.a = Anim.Linear(normalColor.a, highlightColor.a, 0.2f, 1f);
                }
            }

            animationDuration = 4 / rippleSpeed;
        }
Beispiel #2
0
        float UpdateAnimation(float initialValue, float targetValue, float time, float duration, AnimType animationType)
        {
            switch (animationType)
            {
            case AnimType.Linear:
                return(Anim.Linear(initialValue, targetValue, time, duration));

            case AnimType.Overshoot:
                return(Anim.Overshoot(initialValue, targetValue, time, duration));

            case AnimType.Bounce:
                return(Anim.Bounce(initialValue, targetValue, time, duration));

            case AnimType.EaseOutCubed:
                return(Anim.Cube.Out(initialValue, targetValue, time, duration));

            case AnimType.EaseOutQuint:
                return(Anim.Quint.Out(initialValue, targetValue, time, duration));

            case AnimType.EaseOutSept:
                return(Anim.Sept.Out(initialValue, targetValue, time, duration));

            case AnimType.EaseInCubed:
                return(Anim.Cube.In(initialValue, targetValue, time, duration));

            case AnimType.EaseInQuint:
                return(Anim.Quint.In(initialValue, targetValue, time, duration));

            case AnimType.EaseInSept:
                return(Anim.Sept.In(initialValue, targetValue, time, duration));

            case AnimType.EaseInOutCubed:
                return(Anim.Cube.InOut(initialValue, targetValue, time, duration));

            case AnimType.EaseInOutQuint:
                return(Anim.Quint.InOut(initialValue, targetValue, time, duration));

            case AnimType.EaseInOutSept:
                return(Anim.Sept.InOut(initialValue, targetValue, time, duration));

            case AnimType.SoftEaseOutCubed:
                return(Anim.Cube.SoftOut(initialValue, targetValue, time, duration));

            case AnimType.SoftEaseOutQuint:
                return(Anim.Quint.SoftOut(initialValue, targetValue, time, duration));

            case AnimType.SoftEaseOutSept:
                return(Anim.Sept.SoftOut(initialValue, targetValue, time, duration));
            }
            return(0f);
        }
Beispiel #3
0
        public void Refresh()
        {
            if (autoSize)
            {
                Rect tempRect = gameObject.GetComponent <RectTransform>().rect;

                if (tempRect.width > tempRect.height)
                {
                    rippleSize = Mathf.RoundToInt(tempRect.width);
                }
                else
                {
                    rippleSize = Mathf.RoundToInt(tempRect.height);
                }

                rippleSize = Mathf.RoundToInt(rippleSize * sizePercentage / 100f);
            }

            normalColor = thisImage.color;

            if (highlightWhen != HighlightActive.Never)
            {
                highlightColor = rippleColor;

                HSBColor highlightColorHSB = HSBColor.FromColor(highlightColor);
                HSBColor normalColorHSB    = HSBColor.FromColor(normalColor);

                if (highlightColorHSB.s <= 0.05f)
                {
                    if (highlightColorHSB.b > 0.5f)
                    {
                        if (normalColorHSB.b > 0.9f)
                        {
                            highlightColorHSB.h = normalColorHSB.h;
                            highlightColorHSB.s = normalColorHSB.s - 0.1f;
                            highlightColorHSB.b = normalColorHSB.b + 0.2f;
                        }
                        else
                        {
                            highlightColorHSB.h = normalColorHSB.h;
                            highlightColorHSB.s = normalColorHSB.s;
                            highlightColorHSB.b = normalColorHSB.b + 0.2f;
                        }
                    }
                    else
                    {
                        highlightColorHSB.h = normalColorHSB.h;
                        highlightColorHSB.s = normalColorHSB.s;
                        highlightColorHSB.b = normalColorHSB.b - 0.15f;
                    }

                    highlightColor   = HSBColor.ToColor(highlightColorHSB);
                    highlightColor.a = normalColor.a;
                }
                else
                {
                    highlightColor.r = Anim.Linear(normalColor.r, highlightColor.r, 0.2f, 1f);
                    highlightColor.g = Anim.Linear(normalColor.g, highlightColor.g, 0.2f, 1f);
                    highlightColor.b = Anim.Linear(normalColor.b, highlightColor.b, 0.2f, 1f);
                    highlightColor.a = Anim.Linear(normalColor.a, highlightColor.a, 0.2f, 1f);
                }
            }

            animationDuration = 4 / rippleSpeed;
        }