/// <summary> /// Adds a single keyframe to the track. You may use this method to add /// keyframes at arbitrary times. /// </summary> /// <param name="frame"></param> public void Add(AnimationKeyFrame <T> frame) { int insertIndex = this.SearchIndexBelow(frame.Time) + 1; if (insertIndex >= this.keyFrames.Count) { this.keyFrames.Add(frame); } else if (this.keyFrames.Data[insertIndex].Time == frame.Time) { this.keyFrames.Data[insertIndex] = frame; } else { this.keyFrames.Insert(insertIndex, frame); } if (insertIndex == 0 && frame.Time > 0.0f) { this.keyFrames.Insert(0, new AnimationKeyFrame <T>(0.0f, frame.Value)); } }
int IComparable <AnimationKeyFrame <T> > .CompareTo(AnimationKeyFrame <T> other) { return(this.Time.CompareTo(other.Time)); }