Beispiel #1
0
        protected override Color ColorLerp(MutableObject mutable, Color a, Color b, float proportion)
        {
            var endColor = b;

            if (DoApplyColorField.GetFirstValue(mutable))
            {
                endColor =
                    UsePreciseLerp.GetFirstValue(mutable)?
                    ColorUtility.SqrLerpColors(a, b, proportion):
                    a + (b - a) * proportion;
            }

            endColor.a = DoApplyAlphaField.GetFirstValue(mutable) ? a.a + (b.a - a.a) * proportion : b.a;

            return(endColor);
        }
Beispiel #2
0
        protected override Color ColorLerp(MutableObject mutable, Color a, Color b, float proportion)
        {
            float H1, S1, V1;
            float H2, S2, V2;

            ColorUtility.RGBToHSV(a, out H1, out S1, out V1);
            ColorUtility.RGBToHSV(b, out H2, out S2, out V2);

            float endH = ApplyHLerpField.GetFirstValue(mutable) ? H1 + (H2 - H1) * proportion : H2;
            float endS = ApplySLerpField.GetFirstValue(mutable) ? S1 + (S2 - S1) * proportion : S2;
            float endV = ApplyVLerpField.GetFirstValue(mutable) ? V1 + (V2 - V1) * proportion : V2;

            Color endColor = ColorUtility.HsvtoRgb(endH, endS, endV);

            endColor.a = DoApplyAlphaField.GetFirstValue(mutable)?a.a + (b.a - a.a) * proportion:b.a;

            return(endColor);
        }