创造“乐趣”故事板动画?

发布于 2024-11-19 15:50:11 字数 537 浏览 4 评论 0原文

我目前正在使用这样的故事板:

 DoubleAnimation doubleAnimation = new DoubleAnimation( );
 doubleAnimation.From = _ScrollBar.Value;
 doubleAnimation.To = _Shift;
 doubleAnimation.Duration = new Duration( new TimeSpan( 0, 0, 0, 0, 200 ) );

 Storyboard.SetTarget( doubleAnimation, _ScrollBar );
 Storyboard.SetTargetProperty( doubleAnimation, new PropertyPath( RangeBase.ValueProperty ) );

 storyboard.Children.Add( doubleAnimation );
 storyboard.Begin( );

线性滚动滚动条。现在我想知道是否有任何快速简单的方法可以使动画变得有趣(即非线性)。也许有类似摆动效果的东西?

I'm currently using storyboarding like this:

 DoubleAnimation doubleAnimation = new DoubleAnimation( );
 doubleAnimation.From = _ScrollBar.Value;
 doubleAnimation.To = _Shift;
 doubleAnimation.Duration = new Duration( new TimeSpan( 0, 0, 0, 0, 200 ) );

 Storyboard.SetTarget( doubleAnimation, _ScrollBar );
 Storyboard.SetTargetProperty( doubleAnimation, new PropertyPath( RangeBase.ValueProperty ) );

 storyboard.Children.Add( doubleAnimation );
 storyboard.Begin( );

Which linearly scrolls a scrollbar. Now I was wondering if there's any quick'n'easy ways to make the animation fun (i.e. none linear). Maybe something like a wobble effect?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄想挽回 2024-11-26 15:50:11

You need to look at EasingFunctions that are a part of animations. These allow you to specify an effect (there are a bunch of pre-canned ones to choose from), and it will apply a formula to your linear value change, thus 'wobbling' it up a bit.

References:

Don't make the basic mistake of going overboard with these though - you don't want to annoy the crap out of the user :)
Now that you know what you are looking for, you will also find that there are a bunch of previous questions here on SO about this sort of thing which you can check through.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文