Octgn.Play.Gui.CardControl.AnimateOrientation C# (CSharp) Method

AnimateOrientation() private method

private AnimateOrientation ( CardOrientation newOrientation ) : void
newOrientation CardOrientation
return void
        private void AnimateOrientation(CardOrientation newOrientation)
        {
            double target90 = (newOrientation & CardOrientation.Rot90) != 0 ? 90 : 0;
            double target180 = (newOrientation & CardOrientation.Rot180) != 0 ? 180 : 0;
            if (Math.Abs(target90 - rotate90.Angle) > double.Epsilon)
            {
                var anim = new DoubleAnimation(target90, TimeSpan.FromMilliseconds(300), FillBehavior.HoldEnd) { EasingFunction = new ExponentialEase() };
                rotate90.BeginAnimation(RotateTransform.AngleProperty, anim);
            }
            if (Math.Abs(target180 - rotate180.Angle) <= double.Epsilon) return;
            var animation = new DoubleAnimation(target180, TimeSpan.FromMilliseconds(600), FillBehavior.HoldEnd) { EasingFunction = new ExponentialEase() };
            rotate180.BeginAnimation(RotateTransform.AngleProperty, animation);
        }