MatrixAnimationUsingPath.IsAngleCumulative Propriété

Définition

Obtient ou définit une valeur qui spécifie si l’angle de rotation de la matrice animée doit s’accumuler au fil des répétitions.

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

Valeur de propriété

true si l’angle de rotation de l’animation doit s’accumuler au fil des répétitions ; sinon, false. La valeur par défaut est false.

Exemples

L’exemple suivant utilise deux animations similaires MatrixAnimationUsingPath pour animer le même rectangle. Les deux animations ont le même PathGeometry paramètre, ce qui entraîne la rotation du rectangle à mesure qu’il se déplace le long de l’écran vers la droite, et les deux animations sont configurées pour se répéter quatre fois. La propriété de la IsAngleCumulative première animation est définie sur false, de sorte que le rectangle revient à son angle d’origine lorsque l’animation se répète. La propriété de la IsAngleCumulative deuxième animation est définie sur true; par conséquent, l’angle du rectangle semble augmenter lorsque l’animation se répète, au lieu de revenir à sa valeur d’origine.

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

Remarques

Si cette propriété est définie sur true, l’angle de rotation de la matrice animée s’accumule à mesure que l’animation se répète. Si votre chemin est un petit arc, un angle cumulé entraîne une rotation continue de votre objet à chaque répétition au lieu de redémarrer la rotation. Lorsqu’il est combiné avec un IsOffsetCumulative de true, votre objet peut sembler s’effondrer pendant qu’il rebondit (en fonction du chemin que vous spécifiez). Pour plus d'informations, consultez IsOffsetCumulative.

La définition de cette propriété n’a aucun effet si DoesRotateWithTangent est false.

Cette propriété détermine si l’angle de la matrice d’animation s’accumule lorsque l’animation se répète en raison de son RepeatBehavior paramètre ; elle n’entraîne pas l’accumulation du décalage lors du redémarrage de l’animation. Pour plus d’informations sur la façon de créer une animation à partir des valeurs d’une animation précédente, consultez IsAdditive.

Informations sur les propriétés de dépendance

Champ Identificateur IsAngleCumulativeProperty
Propriétés de métadonnées définies sur true Aucun

S’applique à

Voir aussi