예제 #1
0
        public static float GetNormalizedValue(this AnimationCurve curve, float t)
        {
            float tmin = curve.GetMinTime();
            float tmax = curve.GetMaxTime();
            float lerp = Mathf.Lerp(tmin, tmax, t);
            float v    = curve.Evaluate(lerp);

            tmin = curve.GetStartValue();
            tmax = curve.GetEndValue();
            float len = tmax - tmin;

            return(len == 0 ? v : (v - tmin) / len);
        }