UnityEngine.AnimationCurve.Linear C# (CSharp) Method

Linear() public static method

A straight Line starting at timeStart, valueStart and ending at timeEnd, valueEnd.

public static Linear ( float timeStart, float valueStart, float timeEnd, float valueEnd ) : AnimationCurve
timeStart float The start time for the linear curve.
valueStart float The start value for the linear curve.
timeEnd float The end time for the linear curve.
valueEnd float The end value for the linear curve.
return AnimationCurve
        public static AnimationCurve Linear(float timeStart, float valueStart, float timeEnd, float valueEnd)
        {
            float outTangent = (valueEnd - valueStart) / (timeEnd - timeStart);
            Keyframe[] keys = new Keyframe[] { new Keyframe(timeStart, valueStart, 0f, outTangent), new Keyframe(timeEnd, valueEnd, outTangent, 0f) };
            return new AnimationCurve(keys);
        }

Usage Example

コード例 #1
0
 public static AnimationCurve Constant(float timeStart, float timeEnd, float value)
 {
     return(AnimationCurve.Linear(timeStart, value, timeEnd, value));
 }