Timeline.BeginTime プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
この Timeline を開始する時間を取得または設定します。
public:
property Nullable<TimeSpan> BeginTime { Nullable<TimeSpan> get(); void set(Nullable<TimeSpan> value); };
public TimeSpan? BeginTime { get; set; }
member this.BeginTime : Nullable<TimeSpan> with get, set
Public Property BeginTime As Nullable(Of TimeSpan)
プロパティ値
この Timeline を開始する時間 (親の BeginTime に対する相対的な時間)。 このタイムラインがルート タイムラインの場合は、対話による開始時間 (タイムラインがトリガーされた時間) に対する相対的な時間になります。 この値には、正の値、負の値、または null
を指定できます。値が null
の場合、そのタイムラインは再生されません。 既定値はゼロです。
例
タイムラインの BeginTime プロパティは、タイムラインのアクティブ期間の開始を決定します。 タイムラインに親タイムラインがある場合、 プロパティは、 BeginTime タイムラインが開始されてから開始されるまでの時間を決定します。 タイムラインがルート タイムライン ( Storyboard例: BeginTime ) の場合、 プロパティは、タイムラインがトリガーされた後に再生を開始するのにかかる時間を決定します。
次の例は、設定が異なる複数の異なる BeginTime タイムラインを示しています。
<!-- This example shows how the BeginTime property determines when a timeline starts.
Several rectangles are animated by DoubleAnimations with identical
durations and target values, but with different
BeginTime settings. -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="BeginTime Example">
<StackPanel Margin="20">
<!-- The rectangles to animate. -->
<Rectangle Name="DefaultBeginTimeRectangle"
Width="20" Height="20" Fill="Blue" />
<Rectangle Name="DelayedBeginTimeRectangle"
Width="20" Height="20" Fill="Blue" />
<Rectangle Name="DelayedAnimationWithDelayedParentRectangle"
Width="20" Height="20" Fill="Blue" />
<Rectangle Name="NegativeBeginTimeExampleRectangle"
Width="20" Height="20" Fill="Blue" />
<!-- Create a button to start the animations. -->
<Button Margin="20" Content="Start Animations">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- This animation starts as soon as the button is clicked, because it
has a BeginTime of 0. -->
<DoubleAnimation
Storyboard.TargetName="DefaultBeginTimeRectangle"
Storyboard.TargetProperty="Width"
BeginTime="0:0:0" From="100" To="600" Duration="0:0:5" />
<!-- This animation starts 5 seconds after the button is clicked. -->
<DoubleAnimation
Storyboard.TargetName="DelayedBeginTimeRectangle"
Storyboard.TargetProperty="Width"
BeginTime="0:0:5" From="100" To="600" Duration="0:0:5" />
<ParallelTimeline BeginTime="0:0:5">
<!-- This animation starts 10 seconds after the button is clicked,
because its parent has a BeginTime of 5 seconds and it has
a BeginTime of 5 seconds: 5 + 5 = 10. -->
<DoubleAnimation
Storyboard.TargetName="DelayedAnimationWithDelayedParentRectangle"
Storyboard.TargetProperty="Width"
BeginTime="0:0:5" From="100" To="600" Duration="0:0:5" />
</ParallelTimeline>
<!-- This animation starts as soon as the button is clicked, but
it animates from 350 to 600 instead of from 100 to 600
because of its negative BeginTime. The negative BeginTime
setting advances the animation, so that it behaves as though
it had already been playing for 2.5 seconds as soon as it is
started. -->
<DoubleAnimation
Storyboard.TargetName="NegativeBeginTimeExampleRectangle"
Storyboard.TargetProperty="Width"
BeginTime="-0:0:2.5" From="100" To="600" Duration="0:0:5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<!-- This example demonstrates how the BeginTime property works on a root timeline. -->
<Rectangle Name="RootTimelineWithDelayedBeginTimeRectangle"
Width="20" Height="20" Fill="Blue" >
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard BeginTime="0:0:5">
<!-- This animation starts 5 seconds after the left mouse button
is pressed, because its parent storyboard (a root timeline)
has a BeginTime of 5 seconds. -->
<DoubleAnimation
Storyboard.TargetName="RootTimelineWithDelayedBeginTimeRectangle"
Storyboard.TargetProperty="Width"
BeginTime="0:0:0" From="100" To="600" Duration="0:0:2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</StackPanel>
</Page>
注釈
プロパティは BeginTime 、シーケンス内で再生するタイムラインを作成する場合に便利です。同じ親を BeginTime 共有する連続するタイムラインを増やすことで、再生時間をずらすことができます。
負の値
負の値を指定 BeginTime すると、 Timeline は過去のある時点で開始したかのように動作します。 たとえば、 Timeline が BeginTime 負の 2.5 秒で、a が 5 秒の を持つ は Duration 、開始時に途中で終了しているように見えます。
BeginTime と SpeedRatio
プロパティによって記述される BeginTime 時間は、タイムラインの親の時刻で測定されます。 たとえば、 が BeginTime 5 のタイムラインで、親の が SpeedRatio 2 である場合、実際には 2.5 秒後に開始されます。
タイムラインの独自 SpeedRatio の設定は、その BeginTimeに影響しません。 たとえば、a BeginTime が 5 秒、a SpeedRatio が 2、親タイムラインが 1 であるタイムライン SpeedRatio は、2.5 ではなく 5 秒後に開始されます。
依存プロパティ情報
識別子フィールド | BeginTimeProperty |
に設定されたメタデータ プロパティ true |
なし |
XAML 属性の使用方法
<オブジェクトBeginTime="[-][days.]hours:minutes:seconds[.fractionalSeconds]"/>
または
<オブジェクトBeginTime="[-][days.]hours:minutes"/>
または
<オブジェクトBeginTime="[-]days"/>
または
<オブジェクトBeginTime="{x:Null マークアップ拡張機能}"/>
XAML 値
角かっこ ([
と ]
) の項目は省略可能です。
days
System.Int32
この開始時刻の日数を表す 0 以上の値。
hours
System.Int32
この開始時刻に含まれる時間数を表す 0 ~ 23 の値。
この開始時刻までの分数を表す 0 ~ 59 の値。
seconds
System.Int32
この開始時刻までの秒数を表す 0 ~ 59 の値。
fractionalSeconds
System.Int32
秒の小数部を表す 1 ~ 7 桁の数字で構成される値。
完全な TimeSpan 構文については、ページの「解説」セクションを Parse 参照してください。
適用対象
こちらもご覧ください
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示