Internal_CalculateLinearTangent() private static method

private static Internal_CalculateLinearTangent ( AnimationCurve curve, int index, int toIndex ) : float
curve AnimationCurve
index int
toIndex int
return float
示例#1
0
 private static void Internal_UpdateTangents(AnimationCurve curve, int index)
 {
     if (index >= 0 && index < curve.length)
     {
         Keyframe key = curve[index];
         if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Linear && index >= 1)
         {
             key.inTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index - 1);
             curve.MoveKey(index, key);
         }
         if (AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Linear && index + 1 < curve.length)
         {
             key.outTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index + 1);
             curve.MoveKey(index, key);
         }
         if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.ClampedAuto || AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.ClampedAuto)
         {
             AnimationUtility.Internal_CalculateAutoTangent(curve, index);
         }
         if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Auto || AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Auto)
         {
             curve.SmoothTangents(index, 0f);
         }
         if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Free && AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Free && !AnimationUtility.GetKeyBroken(key))
         {
             key.outTangent = key.inTangent;
             curve.MoveKey(index, key);
         }
         if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Constant)
         {
             key.inTangent = float.PositiveInfinity;
             curve.MoveKey(index, key);
         }
         if (AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Constant)
         {
             key.outTangent = float.PositiveInfinity;
             curve.MoveKey(index, key);
         }
     }
 }
示例#2
0
        private static void Internal_UpdateTangents(AnimationCurve curve, int index)
        {
            if (index < 0 || index >= curve.length)
            {
                throw new ArgumentException("Index out of bounds.");
            }
            Keyframe key = curve[index];

            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Linear && index >= 1)
            {
                key.inTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index - 1);
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Linear && index + 1 < curve.length)
            {
                key.outTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index + 1);
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Auto || AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Auto)
            {
                curve.SmoothTangents(index, 0f);
            }
            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Free && AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Free && !AnimationUtility.Internal_GetKeyBroken(key))
            {
                key.outTangent = key.inTangent;
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Constant)
            {
                key.inTangent = float.PositiveInfinity;
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Constant)
            {
                key.outTangent = float.PositiveInfinity;
                curve.MoveKey(index, key);
            }
        }