WPF:Animation动画--KeyFramesExample帧动画(1)

KeyFrame相关知识扩展,示例见后续章节
继承System.Windows.Freezable的相关KeyFrame:

     System.Windows.Media.Animation.BooleanKeyFrame
     System.Windows.Media.Animation.BooleanKeyFrameCollection
     System.Windows.Media.Animation.ByteKeyFrame
     System.Windows.Media.Animation.ByteKeyFrameCollection
     System.Windows.Media.Animation.CharKeyFrame
     System.Windows.Media.Animation.CharKeyFrameCollection
     System.Windows.Media.Animation.ColorKeyFrame
     System.Windows.Media.Animation.ColorKeyFrameCollection
     System.Windows.Media.Animation.DecimalKeyFrame
     System.Windows.Media.Animation.DecimalKeyFrameCollection
     System.Windows.Media.Animation.DoubleKeyFrame
     System.Windows.Media.Animation.DoubleKeyFrameCollection
     System.Windows.Media.Animation.EasingFunctionBase
     System.Windows.Media.Animation.Int16KeyFrame
     System.Windows.Media.Animation.Int16KeyFrameCollection
     System.Windows.Media.Animation.Int32KeyFrame
     System.Windows.Media.Animation.Int32KeyFrameCollection
     System.Windows.Media.Animation.Int64KeyFrame
     System.Windows.Media.Animation.Int64KeyFrameCollection
     System.Windows.Media.Animation.KeySpline
     System.Windows.Media.Animation.MatrixKeyFrame
     System.Windows.Media.Animation.MatrixKeyFrameCollection
     System.Windows.Media.Animation.ObjectKeyFrame
     System.Windows.Media.Animation.ObjectKeyFrameCollection
     System.Windows.Media.Animation.Point3DKeyFrame
     System.Windows.Media.Animation.Point3DKeyFrameCollection
     System.Windows.Media.Animation.PointKeyFrame
     System.Windows.Media.Animation.PointKeyFrameCollection
     System.Windows.Media.Animation.QuaternionKeyFrame
     System.Windows.Media.Animation.QuaternionKeyFrameCollection
     System.Windows.Media.Animation.RectKeyFrame
     System.Windows.Media.Animation.RectKeyFrameCollection
     System.Windows.Media.Animation.Rotation3DKeyFrame
     System.Windows.Media.Animation.Rotation3DKeyFrameCollection
     System.Windows.Media.Animation.SingleKeyFrame
     System.Windows.Media.Animation.SingleKeyFrameCollection
     System.Windows.Media.Animation.SizeKeyFrame
     System.Windows.Media.Animation.SizeKeyFrameCollection
     System.Windows.Media.Animation.StringKeyFrame
     System.Windows.Media.Animation.StringKeyFrameCollection
     System.Windows.Media.Animation.ThicknessKeyFrame
     System.Windows.Media.Animation.ThicknessKeyFrameCollection
     System.Windows.Media.Animation.Vector3DKeyFrame
     System.Windows.Media.Animation.Vector3DKeyFrameCollection
     System.Windows.Media.Animation.VectorKeyFrame
     System.Windows.Media.Animation.VectorKeyFrameCollection

clipboard.png

DoubleKeyFrameKeyFrame:关键帧动画的目标值是通过其 KeyFrames 属性定义的,该属性包含DoubleKeyFrame 对象的集合。

  1. 每个 DoubleKeyFrame 都定义一段动画及其自己的目标 Value 和 KeyTime。 动画运行时,它将在指定的关键时间从一个关键值过渡到下一个关键值。
  2. DoubleKeyFrame 类有三种类型,分别对应一个支持的内插方法: LinearDoubleKeyFrame、DiscreteDoubleKeyFrame 和SplineDoubleKeyFrame。
  3. 与 DoubleAnimation 不同,DoubleAnimationUsingKeyFrames 可以有两个以上的目标值。 还可以控制单个 DoubleKeyFrame 段的内插方法。
  4. LinearDoubleKeyFrame 类:通过使用线性内插,可以在前一个关键帧的 Double 值及其自己的 Value 之间进行动画处理。

    1. 此类作为 DoubleKeyFrameCollection 的一部分与 DoubleAnimationUsingKeyFrames 结合使用,以便对一组关键帧中的 Double 属性值进行动画处理。
    2. 关键帧定义了它所属的 DoubleAnimationUsingKeyFrames 段。 每个关键帧都有一个目标 Value 和一个 KeyTime。 KeyTime 指定关键帧的 Value 应到达的时间。
  5. SplineDoubleKeyFrame 类:通过使用样条内插,可以在前一个关键帧的 Double 值及其自己的 Value 之间进行动画处理。

    1. 诸如 SplineDoubleKeyFrame 之类的样条关键帧在各个值之间创建由 KeySpline 属性确定的可变过渡。 可以使用样条内插实现更为逼真的"实际"调速效果,如加速和减速。
    2. KeySpline 中的两个坐标定义这两个控制点。 在描述关键样条时,贝塞尔曲线的起点始终为 0,终点始终为 1,这也就是只定义两个控制点的原因。 所生成的曲线指定如何在一个时间段内内插动画;也就是说,该曲线表示该时间段内动画的目标属性的变化速率。
  6. DiscreteDoubleKeyFrame 类:通过使用离散内插,可以在前一个关键帧的 Double 值及其自己的 Value 之间进行动画处理。

    1. 诸如 DiscreteDoubleKeyFrame 之类的离散关键帧在各个值之间产生突然的“跳跃”(没有内插)。 换句话说,进行动画处理的属性在到达关键帧的关键时间(此时,进行动画处理的属性突然达到目标值)之前不会更改。
  7. EasingDoubleKeyFrame 类:一个类,通过它可以将缓动函数与 DoubleAnimationUsingKeyFrames 关键帧动画相关联。

    1. 使用EasingDoubleKeyFrame.EasingFunction来确定使用那种缓动函数,并选择缓动方式EasingMode。
    2. EasingMode方式有EaseIn、EaseInOut和EaseOut
  8. KeyTime 结构 :在播放动画的有关过程中,KeyTime 实例负责指定特定关键帧应该出现的精确计时。

    1. 每个关键帧的 KeyTime 都指定了该关键帧的结束时间。 它并不指定关键帧播放的时间长度。 关键帧播放时间长度由关键帧的结束时间、前一个关键帧的结束时间以及动画的持续时间来确定。
    2. KeyTime 可以用几种不同的格式表示,包括数字时间值、百分比或特殊标志值 Uniform 和 Paced 中的一个。
    3. <对象 属性="[天数.]小时数:分钟数:秒数[.秒的小数部分]"/>- 或 -<对象 属性="[天数.]小时数:分钟数"/>- 或 -<对象 属性="pctValue%"/>- 或 -<object property="Uniform"/>- 或 -<object property="Paced"/>
    4. Paced的第一帧为开始的0s,之后动画以恒定速率插补。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值