public abstract Rect GetInitialChildPlacement(
     UIElement child,
     Rect currentPlacement,
     Rect targetPlacement,
     AnimationPanel activeLayout,
     ref AnimationRate animationRate,
     out object placementArgs,
     out bool isDone);
 public abstract Rect GetNextChildPlacement(
     UIElement child,
     TimeSpan currentTime,
     Rect currentPlacement,
     Rect targetPlacement,
     AnimationPanel activeLayout,
     AnimationRate animationRate,
     ref object placementArgs,
     out bool isDone);
Beispiel #3
0
 public override Rect GetInitialChildPlacement( UIElement child, Rect currentPlacement,
     Rect targetPlacement, AnimationPanel activeLayout, ref AnimationRate animationRate,
     out object placementArgs, out bool isDone)
 {
     isDone = ( animationRate.HasSpeed && animationRate.Speed <= 0 ) || ( animationRate.HasDuration && animationRate.Duration.Ticks == 0 );
       if( !isDone )
       {
     Vector startVector = new Vector( currentPlacement.Left + ( currentPlacement.Width / 2 ), currentPlacement.Top + ( currentPlacement.Height / 2 ) );
     Vector finalVector = new Vector( targetPlacement.Left + ( targetPlacement.Width / 2 ), targetPlacement.Top + ( targetPlacement.Height / 2 ) );
     Vector distanceVector = startVector - finalVector;
     animationRate = new AnimationRate( animationRate.HasDuration ? animationRate.Duration
     : TimeSpan.FromMilliseconds( distanceVector.Length / animationRate.Speed ) );
       }
       placementArgs = currentPlacement;
       return currentPlacement;
 }
Beispiel #4
0
 public override Rect GetNextChildPlacement( UIElement child, TimeSpan currentTime,
     Rect currentPlacement, Rect targetPlacement, AnimationPanel activeLayout,
     AnimationRate animationRate, ref object placementArgs, out bool isDone)
 {
     Rect result = targetPlacement;
       isDone = true;
       if( _equation != null )
       {
     Rect from = ( Rect )placementArgs;
     TimeSpan duration = animationRate.Duration;
     isDone = currentTime >= duration;
     if( !isDone )
     {
       double x = _equation.Evaluate( currentTime, from.Left, targetPlacement.Left, duration );
       double y = _equation.Evaluate( currentTime, from.Top, targetPlacement.Top, duration );
       double width = Math.Max( 0, _equation.Evaluate( currentTime, from.Width, targetPlacement.Width, duration ) );
       double height = Math.Max( 0, _equation.Evaluate( currentTime, from.Height, targetPlacement.Height, duration ) );
       result = new Rect( x, y, width, height );
     }
       }
       return result;
 }
 public override Rect GetNextChildPlacement( UIElement child, TimeSpan currentTime, Rect currentPlacement, Rect targetPlacement, AnimationPanel activeLayout, AnimationRate animationRate, ref object placementArgs, out bool isDone )
 {
     throw new InvalidOperationException( ErrorMessages.GetMessage( ErrorMessages.DefaultAnimatorCantAnimate ) );
 }
Beispiel #6
0
 public AnimationRate Subtract( AnimationRate animationRate )
 {
     return this - animationRate;
 }
Beispiel #7
0
        public bool Equals( AnimationRate animationRate )
        {
            if( this.HasDuration )
              {
            if( animationRate.HasDuration )
              return _duration == animationRate._duration;

            return false;
              }
              else // HasSpeed
              {
            if( animationRate.HasSpeed )
            {
              if( DoubleHelper.IsNaN( _speed ) )
            return DoubleHelper.IsNaN( animationRate._speed );

              return _speed == animationRate._speed;
            }

            return false;
              }
        }
Beispiel #8
0
 public AnimationRate Add( AnimationRate animationRate )
 {
     return this + animationRate;
 }
Beispiel #9
0
 public static AnimationRate Plus( AnimationRate animationRate )
 {
     return animationRate;
 }
Beispiel #10
0
 public static bool Equals( AnimationRate t1, AnimationRate t2 )
 {
     return t1.Equals( t2 );
 }
Beispiel #11
0
        public static int Compare( AnimationRate t1, AnimationRate t2 )
        {
            if( t1 < t2 )
            return -1;

              if( t1 > t2 )
            return 1;

              // Neither is greater than the other
              return 0;
        }