0

WPF 很新,但我制作了一个 Surface 应用程序,以在我的办公室接待处引起人们的注意。

http://www.diaryofaninja.com/blog/2012/06/03/building-an-image-and-video-viewer-for-microsoft-surface-20-in-no-time-at-all

我想做的是,如果人们有一段时间没有触摸屏幕(我已经用计时器记录了这个),我想让我的应用程序中的每个对象一个一个地“Throb”得到人们的关注。

我会使用转换还是故事板?

4

1 回答 1

2

我最终在计时器上调用了以下方法:

void RunScaleAnimation(FrameworkElement e)
{

var storyboard = new Storyboard();
var easeOut = new BackEase { EasingMode = EasingMode.EaseOut, Amplitude = 0.3 };

double startHeight = e.ActualHeight;
double startWidth = e.ActualWidth;

var growAnimationHOut = new DoubleAnimation(startHeight, startHeight * 1.05,
                                            TimeSpan.FromMilliseconds(100)) { AutoReverse = true };

var growAnimationWOut = new DoubleAnimation(startWidth, startWidth * 1.05,
                                            TimeSpan.FromMilliseconds(100)) { AutoReverse = true };

growAnimationHOut.EasingFunction = easeOut;
growAnimationWOut.EasingFunction = easeOut;

storyboard.Children.Add(growAnimationHOut);
storyboard.Children.Add(growAnimationWOut);

Storyboard.SetTargetProperty(growAnimationWOut, new PropertyPath(FrameworkElement.WidthProperty));
Storyboard.SetTargetProperty(growAnimationHOut, new PropertyPath(FrameworkElement.HeightProperty));

e.BeginStoryboard(storyboard);
}
于 2012-06-04T03:26:28.570 回答