Exemplo n.º 1
0
 public virtual object GetCurrentValue(object defaultOriginValue,
                                       object defaultDestinationValue,
                                       AnimationClock animationClock)
 {
     return(animationClock.GetCurrentValue(defaultOriginValue, defaultDestinationValue));
 }
Exemplo n.º 2
0
        internal object GetCurrentValue(
            object defaultDestinationValue)
        {
            Debug.Assert(defaultDestinationValue != DependencyProperty.UnsetValue);

            // We have a sticky snapshot value if changes have been made to the
            // animations in this layer since the last tick. This flag will be
            // unset when the next tick starts.
            //
            // Since CurrentTimeInvaliated is raised before CurrentStateInvalidated
            // we need to check the state of the first clock as well to avoid
            // potential first frame issues. In this case _hasStickySnapshotValue
            // will be updated to false shortly.
            if (_hasStickySnapshotValue &&
                _animationClocks[0].CurrentState == ClockState.Stopped)
            {
                return(_snapshotValue);
            }

            // This layer just contains a snapshot value or a fill value after
            // all the clocks have been completed.
            if (_animationClocks == null)
            {
                Debug.Assert(_snapshotValue != DependencyProperty.UnsetValue);

                // In this case, we're using _snapshotValue to store the value,
                // but the value here does not represent the snapshotValue. It
                // represents the fill value of an animation clock that has been
                // removed for performance reason because we know it will never
                // be restarted.

                return(_snapshotValue);
            }

            object currentLayerValue  = _snapshotValue;
            bool   hasUnstoppedClocks = false;

            if (currentLayerValue == DependencyProperty.UnsetValue)
            {
                currentLayerValue = defaultDestinationValue;
            }

            int count = _animationClocks.Count;

            Debug.Assert(count > 0);

            for (int i = 0; i < count; i++)
            {
                AnimationClock clock = _animationClocks[i];

                if (clock.CurrentState != ClockState.Stopped)
                {
                    hasUnstoppedClocks = true;

                    currentLayerValue = clock.GetCurrentValue(
                        currentLayerValue,
                        defaultDestinationValue);
                }
            }

            if (hasUnstoppedClocks)
            {
                return(currentLayerValue);
            }
            else
            {
                return(defaultDestinationValue);
            }
        }
Exemplo n.º 3
0
		public virtual object GetCurrentValue (object defaultOriginValue,
						       object defaultDestinationValue,
						       AnimationClock animationClock)
		{
			return animationClock.GetCurrentValue (defaultOriginValue, defaultDestinationValue);
		}