/// <summary> /// Setup the animation for the point /// </summary> /// <param name="element">Element to run the animation on</param> /// <param name="prop">Property to run the animation on</param> /// <param name="from">starting point</param> /// <param name="to">destination point</param> /// <param name="acceleration">acceleration rate</param> /// <param name="deceleration">deceleration rate</param> /// <param name="durationMS">duration of the animation in milliseconds</param> /// <param name="callbackFunc">callback function</param> public static AnimationClock AnimatePointEasingEquation( DependencyObject element, DependencyProperty prop, Point? from, Point to, int durationMS, double? acceleration, double? deceleration, EventHandler callbackFunc) { Point defaultFrom = element.GetValue(prop) == null ? new Point(0, 0) : (Point)element.GetValue(prop); PointAnimation anim = new PointAnimation(); anim.From = from.GetValueOrDefault(defaultFrom); anim.To = to; return Animate(element, prop, anim, durationMS, null, null, callbackFunc); }
/// <summary> /// Setup the animation for the point /// </summary> /// <param name="element">Element to run the animation on</param> /// <param name="prop">Property to run the animation on</param> /// <param name="function">Type of easing equation</param> /// <param name="mode">type of easing mode</param> /// <param name="from">starting point</param> /// <param name="to">destination point</param> /// <param name="durationMS">duration of the animation in milliseconds</param> /// <param name="callbackFunc">callback function</param> /// <returns></returns> public static AnimationClock AnimatePointEasingEquation( DependencyObject element, DependencyProperty prop, PointEasingFunction function, PointEasingMode mode, Point? from, Point to, int durationMS, EventHandler callbackFunc) { Point defaultFrom = element.GetValue(prop) == null ? new Point(0,0) : (Point)element.GetValue(prop); AnimationTimeline anim = GetPointEasingAnimation(function, mode, from.GetValueOrDefault(defaultFrom), to, durationMS); return Animate(element, prop, anim, durationMS, null, null, callbackFunc); }
protected void MakeMove(Point? point = null) { var oldCurrentPoint = currentPoint; currentPoint = point.GetValueOrDefault(currentPoint); if( field[currentPoint.X, currentPoint.Y] == Cell.Empty ) { field[currentPoint.X, currentPoint.Y] = turn; if( ! CheckGameOver() ) { var oldTurn = turn; turn = (oldTurn == Cell.Cross) ? Cell.Nought : Cell.Cross; Emit(OnTurnChanged, this, turn, oldTurn); } Invalidate(); } currentPoint = oldCurrentPoint; }