예제 #1
0
        protected override void AddRoleCard(CardView card, bool isFaked)
        {
            if (isFaked)
            {
                card.Disappear(0d);
                return;
            }

            card.Position = ComputeCardCenterPos(card, cbRoleBox);

            ScaleTransform scale = new ScaleTransform();
            var transformGroup = new TransformGroup();
            transformGroup.Children.Add(scale);
            card.RenderTransform = transformGroup;

            card.RenderTransformOrigin = new Point(0.5, 0.5);
            DoubleAnimation scaleXAnim = new DoubleAnimation(0.2, new Duration(TimeSpan.FromSeconds(0.5d)));
            DoubleAnimation scaleYAnim = new DoubleAnimation(0.2, new Duration(TimeSpan.FromSeconds(0.5d)));
            Storyboard.SetTarget(scaleXAnim, card);
            Storyboard.SetTarget(scaleYAnim, card);
            Storyboard.SetTargetProperty(scaleXAnim, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"));
            Storyboard.SetTargetProperty(scaleYAnim, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"));
            Storyboard storyboard = new Storyboard();
            storyboard.Children.Add(scaleXAnim);
            storyboard.Children.Add(scaleYAnim);
            var anim = card.GetRebaseAnimation(0.5d);
            if (anim != null) storyboard.Children.Add(anim);
            storyboard.AccelerationRatio = 0.4d;
            storyboard.Begin();
            card.Disappear(0.5d);
        }