protected override Single GetCurrentValue(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock) { if (baseValue == Single.PositiveInfinity) { baseValue = defaultOriginValue; } if (_currentKeyFrameIndex >= (KeyFrames.Count())) { if (animationClock.TimeSpan.Seconds == 0) this._currentKeyFrameIndex = 0; else return baseValue; } // check if key frame is complete. if (animationClock.TimeSpan.TotalMilliseconds >= KeyFrames[_currentKeyFrameIndex].KeyTime.TimeSpan.TotalMilliseconds) { _lastKeyFrameTime = KeyFrames[_currentKeyFrameIndex].KeyTime.TimeSpan.TotalMilliseconds; var value = KeyFrames[_currentKeyFrameIndex].Value; baseValue = value; _currentKeyFrameIndex++; return value; } var currentKeyFrame = KeyFrames[_currentKeyFrameIndex]; var ellapsedTime = animationClock.TimeSpan.TotalMilliseconds - _lastKeyFrameTime; var totalTime = currentKeyFrame.KeyTime.TimeSpan.TotalMilliseconds - _lastKeyFrameTime; if (totalTime == 0) { return currentKeyFrame.InterpolateValue(baseValue, 1.0f); } else { return currentKeyFrame.InterpolateValue(baseValue, (Single)(ellapsedTime / totalTime )); } }
public Storyboard() { _clock = new AnimationClock(); }
public AnimationClockController(AnimationClock clock, TimeSpan duration, Boolean shouldAutoRepeat) { this._clock = clock; this._duration = duration; this._shouldAutoRepeat = shouldAutoRepeat; }
public AnimationClockController(AnimationClock clock, TimeSpan duration) : this (clock, duration, false) { }
protected abstract Single GetCurrentValue(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock);
public override Object GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock) { return GetCurrentValue(Convert.ToSingle(defaultOriginValue), 0f, animationClock); }
public void ApplyAnimationClock(AnimationClock clock) { this._clock = clock; }
public virtual Object GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock) { return null; }