Tag: rendertransform

在代码问题中应用动画ScaleTransform

我试图找出为什么下面的代码似乎不起作用。 它没有给出错误 – 它根本不会缩放。 如果我将其更改为我的第二个代码示例,它实际上似乎有效。 有人有任何想法吗? 谢谢 public static void StartMouseEnterAnimation(Button button) { Storyboard storyboard = new Storyboard(); ScaleTransform scale = new ScaleTransform(1.0, 1.0, 1, 1); button.RenderTransformOrigin = new Point(0.5, 0.5); button.RenderTransform = scale; DoubleAnimation growAnimation = new DoubleAnimation(); growAnimation.Duration = TimeSpan.FromMilliseconds(300); growAnimation.From = 1; growAnimation.To = 1.8; storyboard.Children.Add(growAnimation); Storyboard.SetTargetProperty(growAnimation, new PropertyPath(ScaleTransform.ScaleXProperty)); Storyboard.SetTarget(growAnimation, scale); storyboard.Begin(); […]