开发者

Creating 'fun' storyboard animations?

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.SetTargetPrope开发者_如何学运维rty( 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?


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:

  • Add easing effects on your animations with WPF 4 easing functions
  • Easing Animation with WPF and Silverlight
  • Easing Functions in WPF 4 (and Silverlight)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜