ObjectAnimationUsingKeyFrames クラス

定義

指定した期間にわたって、KeyFrames のセットに沿って Object プロパティの値をアニメーション化します

public ref class ObjectAnimationUsingKeyFrames sealed : Timeline
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
class ObjectAnimationUsingKeyFrames final : Timeline
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ObjectAnimationUsingKeyFrames final : Timeline
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
public sealed class ObjectAnimationUsingKeyFrames : Timeline
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ObjectAnimationUsingKeyFrames : Timeline
Public NotInheritable Class ObjectAnimationUsingKeyFrames
Inherits Timeline
<ObjectAnimationUsingKeyFrames>oneOrMoreDiscreteObjectKeyFrames</ObjectAnimationUsingKeyFrames>
継承
Object Platform::Object IInspectable DependencyObject Timeline ObjectAnimationUsingKeyFrames
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

次の例では、ObjectAnimationUsingKeyFrames クラスを使用して、RectangleFill プロパティをアニメーション化します。 このアニメーションでは、次の方法で 2 つのキー フレームが使用されます。

  1. DiscreteObjectKeyFrame を使用すると、四角形Fill プロパティがアニメーションの最初の 2 秒後に LinearGradientBrush に突然変わります。
  2. アニメーションの 3 番目の秒が経過すると、 Fill プロパティが突然別の LinearGradientBrush に変更され、アニメーションの最後まで残ります (合計 4 秒)。
<StackPanel>
    <StackPanel.Resources>
        <Storyboard x:Name="myStoryboard">

            <!-- ObjectAnimationUsingKeyFrames is used to animate properties that take
         an object as a value. This animation lasts for 4 seconds using 3 KeyFrames which
         swap different brush objects at regular intervals, making the background of the Page
         change. -->
            <ObjectAnimationUsingKeyFrames
         Storyboard.TargetName="animatedRectangle"
         Storyboard.TargetProperty="Fill"
         Duration="0:0:4" RepeatBehavior="Forever">
                <ObjectAnimationUsingKeyFrames.KeyFrames>

                    <!-- Note: Only discrete interpolation (DiscreteObjectKeyFrame) is available for 
                use with ObjectAnimationUsingKeyFrames which merely swaps objects according to
                a specified timeline. Other types of interpolation are too problematic to apply
                to objects.  -->
                    <!-- Using a DiscreteObjectKeyFrame, the Fill property of the Rectangle suddenly  
                changes to a LinearGradientBrush after the first two seconds of the animation. -->
                    <DiscreteObjectKeyFrame KeyTime="0:0:2">
                        <DiscreteObjectKeyFrame.Value>
                            <LinearGradientBrush>
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="Yellow" Offset="0.0" />
                                    <GradientStop Color="Orange" Offset="0.5" />
                                    <GradientStop Color="Red" Offset="1.0" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>

                    <!-- After the third second of the animation, the Fill property is suddenly changed 
                to a different LinearGradientBrush which remains until the end of the animation 
                (4 seconds total). -->
                    <DiscreteObjectKeyFrame KeyTime="0:0:3">
                        <DiscreteObjectKeyFrame.Value>
                            <LinearGradientBrush>
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="White" Offset="0.0" />
                                    <GradientStop Color="MediumBlue" Offset="0.5" />
                                    <GradientStop Color="Black" Offset="1.0" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>

                </ObjectAnimationUsingKeyFrames.KeyFrames>
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
    </StackPanel.Resources>

    <!-- The Fill property of this rectangle is animated. -->
    <Rectangle x:Name="animatedRectangle" Loaded="Rectangle_Loaded" Width="300" Height="300" />

</StackPanel>
// When the rectangle loads, begin the animation.
private void Rectangle_Loaded(object sender, RoutedEventArgs e)
{
    myStoryboard.Begin();
}
' When the rectangle loads, begin the animation.
Private Sub Rectangle_Loaded(ByVal sender As Object, ByVal e As EventArgs)
    myStoryboard.Begin()
End Sub

コンストラクター

ObjectAnimationUsingKeyFrames()

ObjectAnimationUsingKeyFrames クラスの新しいインスタンスを初期化します。

プロパティ

AutoReverse

順方向の反復の完了後に、タイムラインを逆方向に再生するかどうかを示す値を取得または設定します。

(継承元 Timeline)
BeginTime

この タイムライン を開始する時刻を取得または設定します。

(継承元 Timeline)
Dispatcher

このオブジェクトが関連付けられている CoreDispatcher を取得します。 CoreDispatcher は、コードが UI 以外のスレッドによって開始された場合でも、UI スレッド上の DependencyObject にアクセスできる機能を表します。

(継承元 DependencyObject)
Duration

繰り返しをカウントせずに、このタイムラインの再生に要する時間を取得または設定します。

(継承元 Timeline)
EnableDependentAnimation

依存アニメーションと見なされるアニメーションプロパティに、このアニメーション宣言の使用を許可するかどうかを宣言する値を取得または設定します。

EnableDependentAnimationProperty

EnableDependentAnimation 依存関係プロパティを識別します。

FillBehavior

アニメーションがアクティブな期間の終わりに達した後の動作を示す値を取得または設定します。

(継承元 Timeline)
KeyFrames

アニメーションを定義する ObjectKeyFrame オブジェクトのコレクションを取得します。

RepeatBehavior

このタイムラインの繰り返し動作を取得または設定します。

(継承元 Timeline)
SpeedRatio

このタイムラインの進行状況を示す、親に対する相対的なレートを取得または設定 します

(継承元 Timeline)

メソッド

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)

適用対象

こちらもご覧ください