Expression Blend 4 学习笔记

时间:2024-01-06 16:56:56

Animation

  Storyboard(情节提要)在对象和时间线面板中建立和命名,定位到对象(object),通过拖动play head(播放头,时间线中垂直的黄色指示线)定位到特定的时间点,点击“记录关键帧”(keyframe)以记录该时间点发生在选中对象上的事件。【A keyframe is a marker on the timeline that indicates when a property change occurs.】【一定要先移动play head和记录keyframe,然后更改属性。】Storyboard中的事件,还可以通过选中时间线中的keyframe-->更改属性面板中的Easing选项来添加缓动效果。

此时通过点击时间线右上角的play按钮可查看此storyboard的动作。但是,此时运行程序则不会展现动画效果,因为,keyboard的发生是需要特定动作触发的——如behaviors(ControlStoryboardAction)。选中behavior后,可在右侧属性栏中更改要触发的EventName、关联的Storyboard等。

【behaviors的使用:将其添加到对象—>修改相关属性】

  Inherently,behaviors are a logical extension of the existing concept of triggers and actions in WPF. It is immediately obvious that an action is an activity in the most general sense.Actions provide the functionality to do something—but no way to activate that functionality.To invoke an action, you need a trigger. A trigger is an event that occurs when something else happens.【When you shake [trigger] the tree,apples fall [action]. ——> With the help of triggers,actions "snap into action" when specific events occur.】

  Assets中的Behaviors有两种,一种以_Action命名,另一种以_Behavior命名,前者是上述trigger和action关系中的action,而后者更像是上述trigger和action的结合。

  Behavior通常需要添加状态或动作一起使用,如ControlStoryboardAction与定义的storyboard共同作用、GotoStateAction与States共同作用、ChangePropertyAction主要修改属性面板中的TargetObject等。