MatrixAnimationUsingPath.IsAngleCumulative Właściwość

Definicja

Pobiera lub ustawia wartość określającą, czy kąt obrotu animowanej macierzy powinien gromadzić się na powtórzeniach.

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

Wartość właściwości

Boolean

true jeśli kąt obrotu animacji powinien gromadzić się na powtórzeniach; w przeciwnym razie , false. Wartość domyślna to false.

Przykłady

W poniższym przykładzie użyto dwóch podobnych MatrixAnimationUsingPath animacji do animowania tego samego prostokąta. Obie animacje mają to samo PathGeometry ustawienie, co powoduje, że prostokąt jest obracany, gdy przesuwa się wzdłuż ekranu po prawej stronie, a obie animacje są ustawione na powtórzenie cztery razy. Właściwość pierwszej animacji jest ustawiona IsAngleCumulative na false, więc prostokąt przechodzi z powrotem do oryginalnego kąta, gdy animacja się powtarza. Właściwość drugiej animacji IsAngleCumulative jest ustawiona na truewartość ; w rezultacie kąt prostokąta wydaje się zwiększać, gdy animacja się powtarza, a nie wraca do oryginalnej wartości.

<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>

Uwagi

Jeśli ta właściwość jest ustawiona na true, kąt obrotu animowanej macierzy będzie gromadzić się w miarę powtarzania animacji. Jeśli ścieżka jest małym łukiem, skumulowany kąt spowoduje, że obiekt będzie stale obracany przy każdej powtórzeniu zamiast ponownego uruchamiania rotacji. W połączeniu truez elementem IsOffsetCumulative obiekt może wydawać się spadać, gdy odbija się (w zależności od określonej ścieżki). Aby uzyskać powiązane informacje, zobacz IsOffsetCumulative.

Ustawienie tej właściwości nie ma wpływu, jeśli DoesRotateWithTangent ma wartość false.

Ta właściwość określa, czy kąt macierzy animacji gromadzi się, gdy animacja powtarza się ze względu na jego RepeatBehavior ustawienie; nie powoduje to gromadzenia przesunięcia podczas ponownego uruchamiania animacji. Aby uzyskać informacje na temat tworzenia animacji, tworząc wartości poprzedniej animacji, zobacz IsAdditive.

Informacje dotyczące właściwości zależności

Pole identyfikatora IsAngleCumulativeProperty
Właściwości metadanych ustawione na true Brak

Dotyczy

Zobacz też