FrameworkElement.BeginStoryboard メソッド
定義
指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions contained in the provided storyboard.
オーバーロード
BeginStoryboard(Storyboard) |
指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions that are contained in the provided storyboard. |
BeginStoryboard(Storyboard, HandoffBehavior) |
プロパティが既にアニメーション化されていた場合にどうするかを指定するオプションを使用して、指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions contained in the provided storyboard, with options specified for what should happen if the property is already animated. |
BeginStoryboard(Storyboard, HandoffBehavior, Boolean) |
開始後のアニメーションの制御の状態を指定して、指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions contained in the provided storyboard, with specified state for control of the animation after it is started. |
BeginStoryboard(Storyboard)
指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions that are contained in the provided storyboard.
public:
void BeginStoryboard(System::Windows::Media::Animation::Storyboard ^ storyboard);
public void BeginStoryboard (System.Windows.Media.Animation.Storyboard storyboard);
member this.BeginStoryboard : System.Windows.Media.Animation.Storyboard -> unit
パラメーター
- storyboard
- Storyboard
開始するストーリーボード。The storyboard to begin.
例
次の例では、リソースから Storyboard を取得し、内部イベントがクラスで処理されたときにその Storyboard を実行します。The following example retrieves a Storyboard from resources, and then runs that Storyboard when an internal event is class handled.
private void OnImage1Animate(object sender, RoutedEventArgs e)
{
Storyboard s;
s = (Storyboard)this.FindResource("RotateStoryboard");
this.BeginStoryboard(s);
}
Private Sub OnImage1Animate(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim s As Storyboard
s = CType(Me.FindResource("RotateStoryboard"), Storyboard)
Me.BeginStoryboard(s)
End Sub
注釈
一般的なアニメーションのシナリオでは、この方法は使用しません。Most typical animation scenarios do not use this method. 通常は、マークアップで Storyboard または BeginStoryboard 要素を作成し、次に要素の EventTrigger コンテンツとして配置します。Typically, you create the Storyboard or BeginStoryboard element in markup, and then you place these as the EventTrigger content on an element. イベントによってトリガーされると、アニメーションが実行されます。When triggered by the event, the animation then runs. Storyboard の制御側面の大部分は、マークアップで公開されているプロパティによって対処できます。Most of the control aspects of a Storyboard can be addressed by properties that are exposed in markup.
isControllable
、パラメーターを使用しない署名、またはそのパラメーターが false
指定されている場合は、アニメーションが "塗りつぶし" の期間に達するとすぐに、アニメーションに関連付けられているタイムラインの時計が削除されます。For the signatures that do not use the isControllable
, parameter, or when that parameter is specified false
, the timeline clocks that are associated with the animation are removed as soon as the animation reaches the "Fill" period. そのため、1回実行した後にアニメーションを再起動することはできません。Therefore the animation cannot be restarted after running once. アニメーションを制御するには、ストーリーボードがX:Name ディレクティブを持つか、コード内で参照によってアクセスできる必要もあります。Controlling an animation also requires that the storyboard have an x:Name Directive or be accessible by reference in code.
BeginStoryboard(Storyboard, HandoffBehavior)
プロパティが既にアニメーション化されていた場合にどうするかを指定するオプションを使用して、指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions contained in the provided storyboard, with options specified for what should happen if the property is already animated.
public:
void BeginStoryboard(System::Windows::Media::Animation::Storyboard ^ storyboard, System::Windows::Media::Animation::HandoffBehavior handoffBehavior);
public void BeginStoryboard (System.Windows.Media.Animation.Storyboard storyboard, System.Windows.Media.Animation.HandoffBehavior handoffBehavior);
member this.BeginStoryboard : System.Windows.Media.Animation.Storyboard * System.Windows.Media.Animation.HandoffBehavior -> unit
パラメーター
- storyboard
- Storyboard
開始するストーリーボード。The storyboard to begin.
- handoffBehavior
- HandoffBehavior
ストーリーボードに記述されたプロパティが既にアニメーション化されている場合に使用する動作を表す列挙値。A value of the enumeration that describes behavior to use if a property described in the storyboard is already animated.
例
次の例では、リソースから Storyboard を取得し、内部イベントがクラスで処理されたときにその Storyboard を実行します。The following example retrieves a Storyboard from resources, and then runs that Storyboard when an internal event is class handled.
private void OnImage1Animate(object sender, RoutedEventArgs e)
{
Storyboard s;
s = (Storyboard)this.FindResource("RotateStoryboard");
this.BeginStoryboard(s);
}
Private Sub OnImage1Animate(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim s As Storyboard
s = CType(Me.FindResource("RotateStoryboard"), Storyboard)
Me.BeginStoryboard(s)
End Sub
注釈
一般的なアニメーションのシナリオでは、この方法は使用しません。Most typical animation scenarios do not use this method. 通常は、マークアップで Storyboard または BeginStoryboard 要素を作成し、次に要素の EventTrigger コンテンツとして配置します。Typically, you create the Storyboard or BeginStoryboard element in markup, and then you place these as the EventTrigger content on an element. イベントによってトリガーされると、アニメーションが実行されます。When triggered by the event, the animation then runs. Storyboard の制御側面の大部分は、マークアップで公開されているプロパティによって対処できます。Most of the control aspects of a Storyboard can be addressed by properties that are exposed in markup.
isControllable
、パラメーターを使用しない署名、またはそのパラメーターが false
指定されている場合は、アニメーションが "塗りつぶし" の期間に達するとすぐに、アニメーションに関連付けられているタイムラインの時計が削除されます。For the signatures that do not use the isControllable
, parameter, or when that parameter is specified false
, the timeline clocks that are associated with the animation are removed as soon as the animation reaches the "Fill" period. そのため、1回実行した後にアニメーションを再起動することはできません。Therefore the animation cannot be restarted after running once. アニメーションを制御するには、ストーリーボードがX:Name ディレクティブを持つか、コード内で参照によってアクセスできる必要もあります。Controlling an animation also requires that the storyboard have an x:Name Directive or be accessible by reference in code.
ハンドオフ動作は、BeginStoryboardの属性として指定できます。Handoff behavior can be specified as an attribute of BeginStoryboard.
作成 HandoffBehavior の使用Using the Compose HandoffBehavior
Compose HandoffBehaviorを使用して Storyboard、AnimationTimeline、または AnimationClock をプロパティに適用すると、そのプロパティに以前関連付けられていたすべての Clock オブジェクトが引き続きシステムリソースを消費します。タイミングシステムは、クロックを自動的に削除しません。When you apply a Storyboard, AnimationTimeline, or AnimationClock to a property by using the Compose HandoffBehavior, any Clock objects previously associated with that property continue to consume system resources; the timing system does not remove the clocks automatically.
Composeを使用して多数のクロックを適用するときのパフォーマンスの問題を回避するには、アニメーション化されたプロパティから完成したクロックを削除する必要があります。To avoid performance issues when you apply a large number of clocks by 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. 最初のパラメーターとしてアニメーション化するプロパティを指定し、2番目のパラメーターとして
null
します。Specify the property being animated as the first parameter, andnull
as the second. これにより、プロパティからすべてのアニメーションクロックが削除されます。This removes 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 returnsnull
. また、クロックの有効期間が無期限の場合は、Completed イベントが発生しないことにも注意してください。Note also that the Completed event is not raised if the effective duration of the clock is forever. その場合、ユーザーは Remove を呼び出すタイミングを決定する必要があります。In that case, the user must 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 are also disconnected and garbage collected.
クロックオブジェクトの詳細については、「アニメーションとタイミングシステムの概要」を参照してください。For more information about clock objects, see Animation and Timing System Overview.
BeginStoryboard(Storyboard, HandoffBehavior, Boolean)
開始後のアニメーションの制御の状態を指定して、指定したストーリーボードに含まれるアクションのシーケンスを開始します。Begins the sequence of actions contained in the provided storyboard, with specified state for control of the animation after it is started.
public:
void BeginStoryboard(System::Windows::Media::Animation::Storyboard ^ storyboard, System::Windows::Media::Animation::HandoffBehavior handoffBehavior, bool isControllable);
public void BeginStoryboard (System.Windows.Media.Animation.Storyboard storyboard, System.Windows.Media.Animation.HandoffBehavior handoffBehavior, bool isControllable);
member this.BeginStoryboard : System.Windows.Media.Animation.Storyboard * System.Windows.Media.Animation.HandoffBehavior * bool -> unit
パラメーター
- storyboard
- Storyboard
開始するストーリーボード。The storyboard to begin.
- handoffBehavior
- HandoffBehavior
ストーリーボードに記述されたプロパティが既にアニメーション化されている場合に使用する動作を表す列挙値。A value of the enumeration that describes behavior to use if a property described in the storyboard is already animated.
- isControllable
- Boolean
アニメーションを起動した後に、アニメーションを制御できるかどうか (一時停止できるかどうか) を宣言します。Declares whether the animation is controllable (can be paused) after it is started.
注釈
一般的なアニメーションのシナリオでは、この方法は使用しません。Most typical animation scenarios do not use this method. 通常は、マークアップで Storyboard または BeginStoryboard 要素を作成し、次に要素の EventTrigger コンテンツとして配置します。Typically, you create the Storyboard or BeginStoryboard element in markup, and then you place these as the EventTrigger content on an element. イベントによってトリガーされると、アニメーションが実行されます。When triggered by the event, the animation then runs. Storyboard の制御側面の大部分は、マークアップで公開されているプロパティによって対処できます。Most of the control aspects of a Storyboard can be addressed by properties that are exposed in markup.
isControllable
、パラメーターを使用しない署名、またはそのパラメーターが false
指定されている場合は、アニメーションが "塗りつぶし" の期間に達するとすぐに、アニメーションに関連付けられているタイムラインの時計が削除されます。For the signatures that do not use the isControllable
, parameter, or when that parameter is specified false
, the timeline clocks that are associated with the animation are removed as soon as the animation reaches the "Fill" period. そのため、1回実行した後にアニメーションを再起動することはできません。Therefore the animation cannot be restarted after running once. アニメーションを制御するには、ストーリーボードがX:Name ディレクティブを持つか、コード内で参照によってアクセスできる必要もあります。Controlling an animation also requires that the storyboard have an x:Name Directive or be accessible by reference in code.
ハンドオフ動作は、BeginStoryboardの属性として指定できます。Handoff behavior can be specified as an attribute of BeginStoryboard.
作成 HandoffBehavior の使用Using the Compose HandoffBehavior
Compose HandoffBehaviorを使用して Storyboard、AnimationTimeline、または AnimationClock をプロパティに適用すると、そのプロパティに以前関連付けられていたすべての Clock オブジェクトが引き続きシステムリソースを消費します。タイミングシステムは、クロックを自動的に削除しません。When you apply a Storyboard, AnimationTimeline, or AnimationClock to a property by using the Compose HandoffBehavior, any Clock objects previously associated with that property continue to consume system resources; the timing system does not remove the clocks automatically.
Composeを使用して多数のクロックを適用するときのパフォーマンスの問題を回避するには、アニメーション化されたプロパティから完成したクロックを削除する必要があります。To avoid performance issues when you apply a large number of clocks by 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. 最初のパラメーターとしてアニメーション化するプロパティを指定し、2番目のパラメーターとして
null
します。Specify the property being animated as the first parameter, andnull
as the second. これにより、プロパティからすべてのアニメーションクロックが削除されます。This removes 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 returnsnull
. また、クロックの有効期間が無期限の場合は、Completed イベントが発生しないことにも注意してください。Note also that the Completed event is not raised if the effective duration of the clock is forever. その場合、ユーザーは Remove を呼び出すタイミングを決定する必要があります。In that case, the user must 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 are also disconnected and garbage collected.
クロックオブジェクトの詳細については、「アニメーションとタイミングシステムの概要」を参照してください。For more information about clock objects, see Animation and Timing System Overview.