34 lines
1002 B
C#
34 lines
1002 B
C#
using UnityEngine;
|
|
|
|
public static class AnimationCurveExtensions {
|
|
|
|
public static AnimationCurve Smooth01;
|
|
public static AnimationCurve Smooth10;
|
|
|
|
static AnimationCurveExtensions(){
|
|
Smooth01 = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);
|
|
Smooth10 = AnimationCurve.EaseInOut(0.0f, 1.0f, 1.0f, 0.0f);
|
|
}
|
|
|
|
// HACK tangentを見ていないので完璧ではない
|
|
public static float GetMax(this AnimationCurve ac){
|
|
float result = 0.0f;
|
|
foreach(var keyframe in ac.keys){
|
|
if(result < keyframe.value){
|
|
result = keyframe.value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
// HACK tangentを見ていないので完璧ではない
|
|
public static float GetMin(this AnimationCurve ac){
|
|
float result = float.MaxValue;
|
|
foreach(var keyframe in ac.keys){
|
|
if(result > keyframe.value){
|
|
result = keyframe.value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|