Share via


MatrixAnimationUsingPath.IsAngleCumulative Propiedad

Definición

Obtiene o establece un valor que especifica si el ángulo de giro de la matriz animada se debe acumular en las repeticiones.

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 propiedad

true si se debe acumular el ángulo de giro de la animación en las repeticiones; de lo contrario, false. De manera predeterminada, es false.

Ejemplos

En el ejemplo siguiente se usan dos animaciones similares MatrixAnimationUsingPath para animar el mismo rectángulo. Ambas animaciones tienen la misma PathGeometry configuración, lo que hace que el rectángulo gire mientras se mueve a lo largo de la pantalla a la derecha, y ambas animaciones se establecen para repetirse cuatro veces. La primera propiedad de IsAngleCumulative animación se establece falseen , por lo que el rectángulo vuelve a su ángulo original cuando se repite la animación. La segunda propiedad de IsAngleCumulative animación se establece trueen ; como resultado, el ángulo del rectángulo parece aumentar cuando se repite la animación, en lugar de volver a su 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>

Comentarios

Si esta propiedad se establece trueen , el ángulo de rotación de la matriz animada se acumulará a medida que se repite la animación. Si el trazado es un arco pequeño, un ángulo acumulativo hará que el objeto gire continuamente con cada repetición en lugar de reiniciar la rotación. Cuando se combina con un IsOffsetCumulative de true, es posible que el objeto aparezca como tumble mientras rebota (según la ruta de acceso que especifique). Para obtener información relacionada, vea IsOffsetCumulative.

Establecer esta propiedad no tiene ningún efecto si DoesRotateWithTangent es false.

Esta propiedad determina si el ángulo de la matriz de animación se acumula cuando la animación se repite debido a su RepeatBehavior configuración; no hace que el desplazamiento se acumule cuando se reinicia la animación. Para obtener información sobre cómo crear una animación a partir de los valores de una animación anterior, vea IsAdditive.

Información sobre propiedades de dependencia

Campo identificador IsAngleCumulativeProperty
Propiedades de metadatos establecidas en true Ninguno

Se aplica a

Consulte también