Internal_CalculateAutoTangent() private method

private Internal_CalculateAutoTangent ( AnimationCurve curve, int index ) : void
curve AnimationCurve
index int
return void
Beispiel #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);
         }
     }
 }