Silverlight动画之 Animation Easing

使用Animation Easing函数可以创造出更具有动感的动画。对比下面两个动画。

普通线性动画:

Silverlight动画之 Animation Easing
<Storyboard x:Name="growStoryboard">
<DoubleAnimation
Storyboard.TargetName="cmdGrow" Storyboard.TargetProperty="Width"
To="400" Duration="0:0:1.5"></DoubleAnimation>
</Storyboard>
Silverlight动画之 Animation Easing

使用Easing Function:

Silverlight动画之 Animation Easing
<Storyboard x:Name="growStoryboard">
<DoubleAnimation
Storyboard.TargetName="cmdGrow" Storyboard.TargetProperty="Width"
To="400" Duration="0:0:1.5">
<DoubleAnimation.EasingFunction>
<ElasticEase EasingMode="EaseOut" Oscillations="5"></ElasticEase>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
Silverlight动画之 Animation Easing

通过VS写下这段代码并运行,你就知道加了Easing Function后与之前的显著差别。使用Easing Function,可以让我们很简单的创建效果复杂的动画。

每一个Easing Function都继承自EasingFunctionBase并实现EasingMode。EasingMode有三个值:EaseIn,EaseOut和EaseInOut。

EaseOut变化曲线图:

Silverlight动画之 Animation Easing

EaseIn变化曲线图:

Silverlight动画之 Animation Easing

Silverlight提供了11种easing functions

  • BackEase
  • ElasticEase
  • BounceEase
  • CircleEase
  • CubicEase
  • QuadraticEase
  • QuarticEase
  • QuinticEase
  • SineEase
  • PowerEase
  • ExponentialEase

 下图是六种比较常用的easing functions曲线变化图:

Silverlight动画之 Animation Easing

 

 

Silverlight动画之 Animation Easing,布布扣,bubuko.com

Silverlight动画之 Animation Easing

上一篇:Twitter分布式自增ID算法snowflake原理解析


下一篇:css选择器的那些事