MatrixAnimationUsingPath.IsAngleCumulative Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe ou define um valor que especifica se o ângulo de rotação da matriz animada deve acumular-se ao longo das repetições.
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
Valor de Propriedade
true se o ângulo de rotação da animação se acumular ao longo das repetições; caso contrário, false. A predefinição é false.
Exemplos
O exemplo seguinte usa duas animações semelhantes MatrixAnimationUsingPath para animar o mesmo retângulo. Ambas as animações têm a mesma PathGeometry definição, o que faz com que o retângulo rode ao mover-se para a direita no ecrã, e ambas as animações são definidas para se repetir quatro vezes. A propriedade da IsAngleCumulative primeira animação está definida para false, pelo que o retângulo volta ao seu ângulo original quando a animação se repete. A propriedade da IsAngleCumulative segunda animação é definida para true; como resultado, o retângulo parece aumentar quando a animação se repete, em vez de voltar ao seu valor original.
<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>
Observações
Se esta propriedade for definida para true, o ângulo de rotação da matriz animada irá acumular-se à medida que a animação se repete. Se o teu caminho for um arco pequeno, um ângulo cumulativo fará com que o objeto rode continuamente a cada repetição em vez de reiniciar a rotação. Quando combinado com um IsOffsetCumulative de true, o seu objeto pode parecer que está a rolar enquanto quica (dependendo do caminho que especificar). Para informações relacionadas, veja IsOffsetCumulative.
Definir esta propriedade não tem efeito se DoesRotateWithTangent for false.
Esta propriedade determina se o ângulo da matriz de animação se acumula quando a animação se repete devido à sua RepeatBehavior definição; não faz com que o deslocamento se acumule quando a animação é reiniciada. Para informações sobre como fazer uma animação basear-se nos valores de uma animação anterior, veja IsAdditive.
Informação de Propriedade de Dependência
| Iteme | Value |
|---|---|
| Campo identificador | IsAngleCumulativeProperty |
Propriedades dos metadados definidas como true |
None |