protected override void AddRoleCard(CardView card, bool isFaked) { if (isFaked) { card.Disappear(0d, true); 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); card.AddRebaseAnimation(storyboard, 0.5d); storyboard.AccelerationRatio = 0.4d; storyboard.Begin(); card.Disappear(0.5d, true); }
protected override void AddRoleCard(CardView card, bool isFaked) { if (isFaked) { card.Disappear(0d, true); 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); card.AddRebaseAnimation(storyboard, 0.5d); storyboard.AccelerationRatio = 0.4d; storyboard.Begin(); card.Disappear(0.5d, true); }