创造“乐趣”故事板动画?
我目前正在使用这样的故事板:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要查看 EasingFunctions 这是动画的一部分。这些允许您指定一个效果(有一堆预制效果可供选择),并且它将对您的线性值变化应用一个公式,从而将其“摆动”一点。
参考文献:
不过,不要犯过度使用这些功能的基本错误 - 您不想惹恼用户:)
现在您知道了要查找的内容,您还会发现有一堆以前的问题 这里有关于此类的事情,你可以检查一下。
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.