private static void OnTapStatusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AbstractCardCanvas canvas = d as AbstractCardCanvas;
            bool tapped = (bool)e.NewValue;

            if (tapped != (bool)e.OldValue)
            {
                double fromValue = UntappedDegree;
                double toValue   = canvas.TappedDegree;
                if (!tapped)
                {
                    fromValue = canvas.TappedDegree;
                    toValue   = UntappedDegree;
                }
                canvas.RenderTransform = new RotateTransform(0, canvas.Height / 2, canvas.Height / 2);
                DoubleAnimation animation = new DoubleAnimation(fromValue, toValue, new Duration(new TimeSpan(0, 0, 0, 0, 500)))
                {
                    RepeatBehavior = new RepeatBehavior(1)
                };
                canvas.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, animation);
            }
        }
示例#2
0
 private static void OnSetAndIdChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     (d as AbilityCanvas)._artwork.Source = AbstractCardCanvas.GetArtwork((SetAndId)e.NewValue);
 }