MatrixAnimationUsingPath.IsAngleCumulative 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指定动画矩阵的旋转角度是否应在重复时累积。
public:
property bool IsAngleCumulative { bool get(); void set(bool value); };
public bool IsAngleCumulative { get; set; }
member this.IsAngleCumulative : bool with get, set
Public Property IsAngleCumulative As Boolean
属性值
true 如果动画的旋转角度应累积重复,则为否则,为 false. 默认值为 false。
示例
以下示例使用两个类似的 MatrixAnimationUsingPath 动画对同一矩形进行动画处理。 这两个动画具有相同 PathGeometry 的设置,这会导致矩形在屏幕向右移动时旋转,并且两个动画都设置为重复四次。 第一个动画 IsAngleCumulative 的属性设置为 false,因此当动画重复时,矩形会跳回其原始角度。 第二个动画 IsAngleCumulative 的属性设置为 true;因此,当动画重复时,矩形角度似乎会增加,而不是跳回其原始值。
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<StackPanel Margin="50">
<!-- The Rectangle that is animated across the screen by animating
the MatrixTransform applied to the button. -->
<Rectangle
Width="75" Height="25"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" StrokeThickness="1">
<Rectangle.RenderTransform>
<MatrixTransform x:Name="myMatrixTransform">
<MatrixTransform.Matrix >
<Matrix OffsetX="10" OffsetY="100"/>
</MatrixTransform.Matrix>
</MatrixTransform>
</Rectangle.RenderTransform>
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop Color="Lime" Offset="0.0" />
<GradientStop Color="Gray" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- Shows the animation path. -->
<Path
Stroke="Black" StrokeThickness="5"
Data="M 0,0 A 50,50 0 1 0 100,0" />
<StackPanel Margin="0,200,0,0" Orientation="Horizontal">
<Button Content="Animate with IsAngleCumulative set to False"
HorizontalAlignment="Left" Padding="5">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- The angle generated by this animation does not
accumulate over repetitions. As a result,
the rectangle appears to jump back to its
starting angle when the animation repeats. -->
<MatrixAnimationUsingPath
Storyboard.TargetName="myMatrixTransform"
Storyboard.TargetProperty="Matrix"
Duration="0:0:2"
RepeatBehavior="4x"
IsOffsetCumulative="True"
IsAngleCumulative="False"
DoesRotateWithTangent="True">
<MatrixAnimationUsingPath.PathGeometry>
<PathGeometry Figures="M 0,0 A 50,50 0 1 0 100,0" />
</MatrixAnimationUsingPath.PathGeometry>
</MatrixAnimationUsingPath>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Button Content="Animate with IsAngleCumulative set to True"
HorizontalAlignment="Left"
Padding="5">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- The angle generated by this animation accumulates
over repetitions. As a result, the rectangle's
rotation appears seamless. -->
<MatrixAnimationUsingPath
Storyboard.TargetName="myMatrixTransform"
Storyboard.TargetProperty="Matrix"
Duration="0:0:2"
RepeatBehavior="4x"
IsOffsetCumulative="True"
IsAngleCumulative="True"
DoesRotateWithTangent="True">
<MatrixAnimationUsingPath.PathGeometry>
<PathGeometry Figures="M 0,0 A 50,50 0 1 0 100,0" />
</MatrixAnimationUsingPath.PathGeometry>
</MatrixAnimationUsingPath>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</StackPanel>
</Page>
注解
如果此属性设置为 true,动画矩阵的旋转角度将随着动画重复而累积。 如果路径是一个小弧线,累积角度将导致对象每次重复旋转,而不是重启旋转。 当与其中一个IsOffsetCumulativetrue组合时,你的对象在弹跳时可能会下降(具体取决于你指定的路径)。 有关相关信息,请参阅 IsOffsetCumulative。
如果为 false,则设置此属性不起作用DoesRotateWithTangent。
此属性确定动画矩阵的角度在动画因 RepeatBehavior 设置而重复时是否累积;它不会导致动画重启时偏移量累积。 有关如何使动画生成之前动画的值的信息,请参阅 IsAdditive。
Dependency 属性信息
| 物品 | 价值 |
|---|---|
| 标识符字段 | IsAngleCumulativeProperty |
元数据属性设置为 true |
没有 |