public float GetValue(float time, IAnimationTimer animationTimer, InterpolatorDelegate interpolator) { if (!this.keyframes.Any()) { return(0); } KeyValuePair <float, float> minTime = this.keyframes.First(); KeyValuePair <float, float> maxTime = this.keyframes.Last(); float startTime = StartingTime; time = startTime + AnimationTimer.Value(time, FinishingTime - startTime); if (time <= minTime.Key) { return(minTime.Value); } if (time >= maxTime.Key) { return(maxTime.Value); } KeyValuePair <float, float> prevTime = this.keyframes.First(kf => kf.Key >= time); KeyValuePair <float, float> succTime = this.keyframes.First(kf => kf.Key > prevTime.Value); float dt = succTime.Key - prevTime.Key; float t = (time - prevTime.Key) / dt; return(interpolator.Invoke(t, prevTime.Value, succTime.Value)); }