Animatable.ApplyAnimationClock メソッド
定義
指定した DependencyProperty を使用して、指定した AnimationClock をアニメーション化します。Animates the specified DependencyProperty using the specified AnimationClock.
オーバーロード
ApplyAnimationClock(DependencyProperty, AnimationClock) |
AnimationClock を指定した DependencyProperty に適用します。Applies an AnimationClock to the specified DependencyProperty. プロパティが既にアニメーション化されている場合は、SnapshotAndReplace ハンドオフ動作が使用されます。If the property is already animated, the SnapshotAndReplace handoff behavior is used. |
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) |
AnimationClock を指定した DependencyProperty に適用します。Applies an AnimationClock to the specified DependencyProperty. プロパティが既にアニメーション化されている場合は、指定した HandoffBehavior が使用されます。If the property is already animated, the specified HandoffBehavior is used. |
ApplyAnimationClock(DependencyProperty, AnimationClock)
AnimationClock を指定した DependencyProperty に適用します。Applies an AnimationClock to the specified DependencyProperty. プロパティが既にアニメーション化されている場合は、SnapshotAndReplace ハンドオフ動作が使用されます。If the property is already animated, the SnapshotAndReplace handoff behavior is used.
public:
virtual void ApplyAnimationClock(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationClock ^ clock);
public void ApplyAnimationClock (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationClock clock);
abstract member ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock -> unit
override this.ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock -> unit
Public Sub ApplyAnimationClock (dp As DependencyProperty, clock As AnimationClock)
パラメーター
アニメーション化するプロパティ。The property to animate.
- clock
- AnimationClock
指定したプロパティをアニメーション化する際に使用するクロック。The clock with which to animate the specified property. clock
が null
の場合は、すべてのアニメーションが指定したプロパティから削除されます (ただし停止されません)。If clock
is null
, all animations will be removed from the specified property (but not stopped).
実装
注釈
このメソッドを使用してプロパティからクロックを削除しても、クロックは停止しないことに注意してください。Note that using this method to removing clocks from a property does not stop those clocks.
適用対象
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)
AnimationClock を指定した DependencyProperty に適用します。Applies an AnimationClock to the specified DependencyProperty. プロパティが既にアニメーション化されている場合は、指定した HandoffBehavior が使用されます。If the property is already animated, the specified HandoffBehavior is used.
public:
virtual void ApplyAnimationClock(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationClock ^ clock, System::Windows::Media::Animation::HandoffBehavior handoffBehavior);
public void ApplyAnimationClock (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationClock clock, System.Windows.Media.Animation.HandoffBehavior handoffBehavior);
abstract member ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock * System.Windows.Media.Animation.HandoffBehavior -> unit
override this.ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock * System.Windows.Media.Animation.HandoffBehavior -> unit
Public Sub ApplyAnimationClock (dp As DependencyProperty, clock As AnimationClock, handoffBehavior As HandoffBehavior)
パラメーター
アニメーション化するプロパティ。The property to animate.
- clock
- AnimationClock
指定したプロパティをアニメーション化する際に使用するクロック。The clock with which to animate the specified property. handoffBehavior
が SnapshotAndReplace であり、clock
が null
である場合、指定したプロパティからすべてのアニメーションが削除されます (停止はされません)。If handoffBehavior
is SnapshotAndReplace and clock
is null
, all animations will be removed from the specified property (but not stopped). handoffBehavior
が Compose であり、クロックが null
である場合、このメソッドは無効です。If handoffBehavior
is Compose and clock is null
, this method has no effect.
- handoffBehavior
- HandoffBehavior
プロパティ値に既に影響を及ぼしている現在のアニメーションと新しいアニメーションが対話する方法を指定する値。A value that specifies how the new animation should interact with any current animations already affecting the property value.
実装
例
次の例は、さまざまな設定を使用してアニメーションクロックを適用する方法を示して HandoffBehavior います。The following example shows how to apply animation clocks using different HandoffBehavior settings.
注釈
このメソッドを使用してプロパティからクロックを削除しても、クロックは停止しないことに注意してください。Note that using this method to remove clocks from a property does not stop those clocks.
作成 HandoffBehavior の使用Using the Compose HandoffBehavior
を Storyboard AnimationTimeline 使用してプロパティに、、またはを適用すると AnimationClock Compose HandoffBehavior 、 Clock そのプロパティに以前関連付けられていたすべてのオブジェクトが引き続きシステムリソースを消費します。タイミングシステムは、これらのクロックを自動的に削除しません。When you apply a Storyboard, AnimationTimeline, or AnimationClock to a property using the Compose HandoffBehavior, any Clock objects previously associated with that property continue to consume system resources; the timing system will not remove these clocks automatically.
Compose を使って大量のクロックを適用するときのパフォーマンスの問題を回避するには、アニメーション化されたプロパティから、構成クロックを完了後に削除する必要があります。To avoid performance issues when you apply a large number of clocks using Compose, you should remove composing clocks from the animated property after they complete. クロックを削除する方法はいくつかあります。There are several ways to remove a clock.
プロパティからすべてのクロックを削除するには、アニメーション化されたオブジェクトの ApplyAnimationClock(DependencyProperty, AnimationClock) または BeginAnimation(DependencyProperty, AnimationTimeline) メソッドを使用します。To remove all clocks from a property, use the ApplyAnimationClock(DependencyProperty, AnimationClock) or BeginAnimation(DependencyProperty, AnimationTimeline) method of the animated object. アニメーション化するプロパティを 1 番目のパラメーターとして指定し、
null
を 2 番目として指定します。Specify the property being animated as the first parameter, andnull
as the second. これにより、すべてのアニメーション クロックがプロパティから削除されます。This will remove all animation clocks from the property.特定の AnimationClock をクロックの一覧から削除するには、AnimationClock の Controller プロパティを使用して ClockControllerを取得し、次に Remove の ClockController メソッドを呼び出します。To remove a specific AnimationClock from a list of clocks, use the Controller property of the AnimationClock to retrieve a ClockController, then call the Remove method of the ClockController. これは通常、クロックの Completed イベント ハンドラーで実行されます。This is typically done in the Completed event handler for a clock. ClockController によって制御できるのはルート クロックのみであることに注意してください。子クロックの Controller プロパティは
null
を返します。Note that only root clocks can be controlled by a ClockController; the Controller property of a child clock will returnnull
. クロックの有効期間が永久の場合は Completed イベントが呼び出されないことにも注意してください。Note also that the Completed event will not be called if the effective duration of the clock is forever. その場合は、ユーザーが Remove を呼び出すタイミングを決定する必要があります。In that case, the user will need to determine when to call Remove.
これは主に、有効期間が長いオブジェクトでのアニメーションの問題です。This is primarily an issue for animations on objects that have a long lifetime. オブジェクトがガベージ コレクションされる場合は、そのクロックも切断されて、ガベージ コレクションされます。When an object is garbage collected, its clocks will also be disconnected and garbage collected.
クロックオブジェクトの詳細については、「 アニメーションとタイミングシステムの概要」を参照してください。For more information about clock objects, see the Animation and Timing System Overview.