Lerp() public static méthode

Linear interpolation of two keyframes. The resulting keyframe will consist of the interpolated time and transformation.
public static Lerp ( JointAnimationKeyFrame frame1, JointAnimationKeyFrame frame2, float amount ) : JointAnimationKeyFrame
frame1 JointAnimationKeyFrame One keyframe
frame2 JointAnimationKeyFrame Another keyframe
amount float Weight of the second keyframe between 0.0 and 1.0
Résultat JointAnimationKeyFrame
        /// <summary>
        /// Calculates a key frame at given time by interpolating between the samples
        /// that are nearest (by time).
        /// </summary>
        /// <param name="time">Time</param>
        /// <returns>Interpolated key frame for given time key</returns>
        public JointAnimationKeyFrame GetInterpolatedKeyframe(float time)
        {
            if (time < StartTime)
            {
                switch (PreBehaviour)
                {
                case AnimationBehaviour.Constant:
                    time = StartTime;
                    break;

                case AnimationBehaviour.Cycle:
                    time = 0;
                    break;

                default:
                    // TODO: Implement other animation behaviours
                    throw new NotImplementedException("No animation behaviours " +
                                                      "other than Constant implemented yet");
                }
            }
            else if (time > EndTime)
            {
                switch (PostBehaviour)
                {
                case AnimationBehaviour.Constant:
                    time = EndTime;
                    break;

                case AnimationBehaviour.Cycle:
                    time %= EndTime;
                    break;

                default:
                    // TODO: Implement other animation behaviours
                    throw new NotImplementedException("No animation behaviours " +
                                                      "other than Constant implemented yet");
                }
            }

            int keyframeIndex = 0;

            // Find the two frames to interpolate between
            while (_keyframes[keyframeIndex].Time <= time)
            {
                keyframeIndex++;
            }

            if (keyframeIndex > 0)
            {
                keyframeIndex--;
            }

            JointAnimationKeyFrame frame1 = _keyframes[keyframeIndex];
            JointAnimationKeyFrame frame2 = _keyframes[keyframeIndex + 1];

            if (frame1.Time == time)
            {
                return(frame1);
            }

            switch (_interpolation)
            {
            case AnimationInterpolation.Linear:
                float amount = 1.0f / (frame2.Time - frame1.Time) * (time - frame1.Time);
                return(JointAnimationKeyFrame.Lerp(frame1, frame2, amount));

            default:
                // TODO: Implement other animation interpolations
                throw new NotImplementedException("No animation interpolation " +
                                                  "other than Linear implemented yet");
            }
        }