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);
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; }
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 ) ); }
public AnimationRate Subtract( AnimationRate animationRate ) { return this - animationRate; }
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; } }
public AnimationRate Add( AnimationRate animationRate ) { return this + animationRate; }
public static AnimationRate Plus( AnimationRate animationRate ) { return animationRate; }
public static bool Equals( AnimationRate t1, AnimationRate t2 ) { return t1.Equals( t2 ); }
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; }