PointAnimation 類別

定義

使用指定Duration的線性插補,以動畫顯示兩個目標值之間的Point屬性值。

public ref class PointAnimation sealed : Timeline
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PointAnimation final : Timeline
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PointAnimation : Timeline
Public NotInheritable Class PointAnimation
Inherits Timeline
<PointAnimation .../>
繼承
Object Platform::Object IInspectable DependencyObject Timeline PointAnimation
屬性

範例

下列範例示範如何使用 PointAnimation 以動畫顯示EllipseGeometryCenter屬性。

// Start the animation when the object loads
void SampleApp::Page::Start_Animation(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    myStoryboard->Begin();
}
<Canvas Width="450" Height="350">
    <Canvas.Resources>
        <Storyboard x:Name="myStoryboard">

            <!-- Animate the center point of the ellipse from 100 X, 300 Y
             to 400 X, 100 Y over 5 seconds. -->
            <PointAnimation
             Storyboard.TargetProperty="Center"
             Storyboard.TargetName="MyAnimatedEllipseGeometry"
             Duration="0:0:5" 
             From="100,300"
             To="400,100"
             RepeatBehavior="Forever" EnableDependentAnimation="True"/>

        </Storyboard>
    </Canvas.Resources>
    <Path Fill="Blue" Loaded="Start_Animation">
        <Path.Data>

            <!-- Describes an ellipse. -->
            <EllipseGeometry x:Name="MyAnimatedEllipseGeometry"
             Center="200,100" RadiusX="15" RadiusY="15" />
        </Path.Data>
    </Path>
</Canvas>
// Start the animation when the object loads
private void Start_Animation(object sender, RoutedEventArgs e)
{
    myStoryboard.Begin();
}

備註

使用 PointAnimation 以動畫顯示 Point類型之任何相依性屬性的屬性值。

Point的線性插補表示XY值會被視為數位,而插補只是數學運算。

有時候,您必須使用間接屬性目標,才能將目標設為目標上另一個物件的子屬性,該物件是目標上的屬性值。 例如,若要建立 PathGeometry部分的動畫效果,您必須參考一些中繼物件屬性值,直到間接屬性路徑的最後一個步驟真正是 Point 值為止。 如需間接屬性目標和其他腳本動畫概念的詳細資訊,請參閱 分鏡腳本動畫屬性路徑語法

PointAnimation 通常至少有一個 FromByTo 屬性已設定,但絕不會全部三者。

  • 僅從: 動畫會從 From 屬性所指定的值進展到要產生動畫效果之屬性的基底值。
  • From 和 To: 動畫會從 From 屬性所指定的值進展到 To 屬性所指定的值。
  • 寄件者和依據: 動畫會從 From 屬性所指定的值進展到 FromBy 屬性的總和所指定的值。
  • 僅限: 動畫會從動畫屬性的基底值或先前動畫的輸出值進展到 To 屬性所指定的值。
  • 僅限: 動畫會從要產生動畫效果的屬性基底值或先前動畫的輸出值,到該值和 By 屬性所指定的值總和。

PointAnimation 的 FromByTo 屬性不是 Point 值。 相反地,這些是Point的可為 Null。 這些的預設值為 null,而不是未初始化的結構。 該 Null 值是動畫系統區分您尚未特別設定值的方式。 Visual C++ 元件延伸 (C++/CX) 沒有 Nullable 型別,所以改用 IReference

建構函式

PointAnimation()

初始化 PointAnimation 類別的新實例。

屬性

AutoReverse

取得或設定值,其中該值指出時間軸是否會在完成向前反覆項目後反向播放。

(繼承來源 Timeline)
BeginTime

取得或設定這個 時間軸 應該開始的時間。

(繼承來源 Timeline)
By

取得或設定動畫變更其起始值所依據的總量。

ByProperty

識別 By 相依性屬性。

Dispatcher

一律會在Windows 應用程式 SDK應用程式中傳 null 回。 請改用 DispatcherQueue

(繼承來源 DependencyObject)
DispatcherQueue

DispatcherQueue取得與這個 物件相關聯的 。 DispatcherQueue表示即使程式碼是由非 UI 執行緒起始,也可以存取 DependencyObject UI 執行緒上的 設備。

(繼承來源 DependencyObject)
Duration

取得或設定這個時間表播放的時間長度 (不計算重複次數)。

(繼承來源 Timeline)
EasingFunction

取得或設定您要套用至動畫的 Easing 函式。

EasingFunctionProperty

識別 EasingFunction 相依性屬性。

EnableDependentAnimation

取得或設定值,這個值會宣告是否應該允許考慮相依動畫的動畫屬性使用此動畫宣告。

EnableDependentAnimationProperty

識別 EnableDependentAnimation 相依性屬性。

FillBehavior

取得或設定值,這個值會指定動畫在到達使用期間結束時的行為。

(繼承來源 Timeline)
From

取得或設定此動畫的起始值。

FromProperty

識別 From 相依性屬性。

RepeatBehavior

取得或設定這個時間軸的重複行為。

(繼承來源 Timeline)
SpeedRatio

取得或設定相對於其父系的速率,此時會進行這個 時間軸

(繼承來源 Timeline)
To

取得或設定此動畫的結束值。

ToProperty

識別 To 相依性屬性。

方法

ClearValue(DependencyProperty)

清除相依性屬性的本機值。

(繼承來源 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

傳回為相依性屬性建立的任何基底值,如果動畫未使用中,則適用此屬性。

(繼承來源 DependencyObject)
GetValue(DependencyProperty)

DependencyObject傳回相依性屬性的目前有效值。

(繼承來源 DependencyObject)
ReadLocalValue(DependencyProperty)

如果已設定本機值,則傳回相依性屬性的本機值。

(繼承來源 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

註冊通知函式,以接聽此DependencyObject實例上特定DependencyProperty的變更。

(繼承來源 DependencyObject)
SetValue(DependencyProperty, Object)

設定 DependencyObject上相依性屬性的本機值。

(繼承來源 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消先前透過呼叫 RegisterPropertyChangedCallback註冊的變更通知。

(繼承來源 DependencyObject)

事件

Completed

發生于 Storyboard 物件已完成播放時。

(繼承來源 Timeline)

適用於

另請參閱