本文整理汇总了C#中UnityEngine.AnimationCurve.RemoveKey方法的典型用法代码示例。如果您正苦于以下问题:C# AnimationCurve.RemoveKey方法的具体用法?C# AnimationCurve.RemoveKey怎么用?C# AnimationCurve.RemoveKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.AnimationCurve
的用法示例。
在下文中一共展示了AnimationCurve.RemoveKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveKeysInRange
public static void RemoveKeysInRange(AnimationCurve curve, float beginTime, float endTime)
{
for (int index = curve.length - 1; index >= 0; --index)
{
if ((double) curve[index].time >= (double) beginTime && (double) curve[index].time < (double) endTime)
curve.RemoveKey(index);
}
}
示例2: RemoveKeysInRange
public static void RemoveKeysInRange(AnimationCurve curve, float beginTime, float endTime)
{
for (int i = curve.length - 1; i >= 0; i--)
{
if (curve[i].time >= beginTime && curve[i].time < endTime)
{
curve.RemoveKey(i);
}
}
}
示例3: RemoveKey
/// <summary>
/// Remove a key from an AnimationCurve.
/// </summary>
/// <param name="curve">The existing AnimationCurve.</param>
/// <param name="index">The index of the Key to be removed.</param>
public static void RemoveKey(AnimationCurve curve, int index)
{
curve.RemoveKey(index);
// Update left neighbour.
if (index > 0)
{
// Update tangent data based on tangent mode.
int tangentMode = curve[index-1].tangentMode;
if (IsAuto(tangentMode))
{
curve.SmoothTangents(index - 1, 0);
}
if (IsBroken(tangentMode))
{
if (IsRightLinear(tangentMode))
{
SetKeyRightLinear(curve, index - 1);
}
}
}
// Update right neighbour.
if (index < curve.length)
{
// Update tangent data based on tangent mode.
int tangentMode = curve[index].tangentMode;
if (IsAuto(tangentMode))
{
curve.SmoothTangents(index, 0);
}
if (IsBroken(tangentMode))
{
if (IsLeftLinear(tangentMode))
{
SetKeyLeftLinear(curve, index);
}
}
}
}
示例4: NormalizeCurveTime
// Function ----------------------------------------------------------------------
public static void NormalizeCurveTime(AnimationCurve curve)
{
int n = 0;
while (n < curve.keys.Length)
{
Keyframe key = curve[n];
float fMax = Mathf.Max(0, key.time);
float fVal = Mathf.Min(1, Mathf.Max(fMax, key.time));
if (fVal != key.time)
{
Keyframe newKey = new Keyframe(fVal, key.value, key.inTangent, key.outTangent);
curve.RemoveKey(n);
n = 0;
curve.AddKey(newKey);
continue;
}
n++;
}
}
示例5: RemoveKeysInRange
public static void RemoveKeysInRange(AnimationCurve curve, float beginTime, float endTime)
{
for (int i = curve.length - 1; i >= 0; i--)
{
Keyframe keyframe = curve[i];
if (keyframe.time >= beginTime)
{
Keyframe keyframe2 = curve[i];
if (keyframe2.time < endTime)
{
curve.RemoveKey(i);
}
}
}
}
示例6: RemoveKeyframe
void RemoveKeyframe(AnimationCurve curve, int keyframeIndex)
{
curve.RemoveKey(keyframeIndex);
Invalidate();
}