Ejemplo n.º 1
0
 public KeyFrameAnimationInstance(
     IInterpolator <T> interpolator, ServerKeyFrame <T>[] keyFrames,
     PropertySetSnapshot snapshot, ExpressionVariant?finalValue,
     ServerObject target,
     AnimationDelayBehavior delayBehavior, TimeSpan delayTime,
     PlaybackDirection direction, TimeSpan duration,
     AnimationIterationBehavior iterationBehavior,
     int iterationCount, AnimationStopBehavior stopBehavior) : base(target, snapshot)
 {
     _interpolator      = interpolator;
     _keyFrames         = keyFrames;
     _finalValue        = finalValue;
     _delayBehavior     = delayBehavior;
     _delayTime         = delayTime;
     _direction         = direction;
     _duration          = duration;
     _iterationBehavior = iterationBehavior;
     _iterationCount    = iterationCount;
     _stopBehavior      = stopBehavior;
     if (_iterationBehavior == AnimationIterationBehavior.Count)
     {
         _totalDuration = delayTime.Add(TimeSpan.FromTicks(iterationCount * _duration.Ticks));
     }
     if (_keyFrames.Length == 0)
     {
         throw new InvalidOperationException("Animation has no key frames");
     }
     if (_duration.Ticks <= 0)
     {
         throw new InvalidOperationException("Invalid animation duration");
     }
 }
 /// <summary>
 /// Specifies how to set the property value when StopAnimation
 /// is called on the encapsulated KeyFrameAnimation object.
 /// </summary>
 /// <param name="stopBehavior">AnimationStopBehavior</param>
 /// <returns>KeyFrameAnimation&lt;T&gt;</returns>
 public KeyFrameAnimation <T> OnStop(AnimationStopBehavior stopBehavior)
 {
     Animation.StopBehavior = stopBehavior;
     return(this);
 }
Ejemplo n.º 3
0
 public static T SetStopBehavior<T>(this T animation, AnimationStopBehavior stopBehavior) where T : KeyFrameAnimation
 {
     animation.StopBehavior = stopBehavior;
     return animation;
 }