共用方式為


MatrixAnimationUsingPath.IsAdditive 屬性

定義

取得或設定值,表示是否應該將目標屬性的目前值加入這個動畫的起始值。

public:
 property bool IsAdditive { bool get(); void set(bool value); };
public bool IsAdditive { get; set; }
member this.IsAdditive : bool with get, set
Public Property IsAdditive As Boolean

屬性值

如果應該將目標屬性的目前值加入這個動畫的起始值,則為 true,否則為 false。 預設為 false

範例

下列範例使用兩個類似的 MatrixAnimationUsingPath 動畫來建立相同矩形的動畫效果。 第一個動畫的 IsAdditive 屬性設定 false 為 ,因此它一律會從動畫的起始值 (0,0) 產生矩形的動畫效果。 第二個動畫具有相同的目標值, (其 PathGeometry 設定相同) ,但其 IsAdditive 屬性會設定為 true ;因此,它會從套用動畫時位於的任何位置建立矩形的動畫效果。

<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" 
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="PresentationOptions">
  <StackPanel>
      
    <!-- The Rectangle that is animated across the screen by animating
         the MatrixTransform applied to the button. -->
    <Rectangle 
      Width="50" Height="20"
      Fill="Blue"
      HorizontalAlignment="Left"
      VerticalAlignment="Top">
      <Rectangle.RenderTransform>
        <MatrixTransform x:Name="myMatrixTransform">
          <MatrixTransform.Matrix >
            <Matrix OffsetX="10" OffsetY="100"/>
          </MatrixTransform.Matrix>
        </MatrixTransform>
      </Rectangle.RenderTransform>
    </Rectangle>
    
    <StackPanel Margin="0,200,0,0" Orientation="Horizontal">
    <Button Content="Animate with IsAdditive set to False"
      HorizontalAlignment="Left" Padding="5">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>
            
              <!-- This animation always moves the 
                   rectangle back to (0,0). -->
              <MatrixAnimationUsingPath
                Storyboard.TargetName="myMatrixTransform"
                Storyboard.TargetProperty="Matrix"
                Duration="0:0:2" 
                DoesRotateWithTangent="True" 
                IsAdditive="False">
                <MatrixAnimationUsingPath.PathGeometry>
                  <PathGeometry 
                    Figures="M 0,0 C 35,0 135,0 160,100 180,190 285,200 310,100" />
                </MatrixAnimationUsingPath.PathGeometry>
              </MatrixAnimationUsingPath>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>   
    </Button>
    
     <Button Content="Animate with IsAdditive set to True"
      HorizontalAlignment="Left" 
      Padding="5">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>
            
              <!-- This animation moves the rectangle from 
                   its current position. -->
              <MatrixAnimationUsingPath
                Storyboard.TargetName="myMatrixTransform"
                Storyboard.TargetProperty="Matrix"
                Duration="0:0:2" 
                DoesRotateWithTangent="True"
                IsAdditive="True">
                <MatrixAnimationUsingPath.PathGeometry>
                  <PathGeometry 
                    Figures="M 0,0 C 35,0 135,0 160,100 180,190 285,200 310,100" />
                </MatrixAnimationUsingPath.PathGeometry>
              </MatrixAnimationUsingPath>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>   
    </Button>   
    </StackPanel>
    
    
  </StackPanel>
</Page>

備註

相依性屬性資訊

識別碼欄位 IsAdditiveProperty
設定為 的中繼資料屬性 true

注意

這個相依性屬性不尋常,因為它的識別碼欄位來自 AnimationTimeline ,而且是由各種衍生類別共用。

適用於