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 ));
            }
        }
Esempio n. 2
0
 public Storyboard()
 {
     _clock = new AnimationClock();
 }
Esempio n. 3
0
 public AnimationClockController(AnimationClock clock, TimeSpan duration, Boolean shouldAutoRepeat)
 {
     this._clock = clock;
     this._duration = duration;
     this._shouldAutoRepeat = shouldAutoRepeat;
 }
Esempio n. 4
0
 public AnimationClockController(AnimationClock clock, TimeSpan duration)
     : this (clock, duration, false)
 {
 }
Esempio n. 5
0
 protected abstract Single GetCurrentValue(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock);
Esempio n. 6
0
 public override Object GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock)
 {
     return GetCurrentValue(Convert.ToSingle(defaultOriginValue), 0f, animationClock);
 }
Esempio n. 7
0
 public void ApplyAnimationClock(AnimationClock clock)
 {
     this._clock = clock;
 }
Esempio n. 8
0
 public virtual Object GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock)
 {
     return null;
 }