今回はアニメーションの開始時間を遅らせてみましょう。
前回の記事に少し修正を加えていきます。
前回まではボタンがクリックされるとすぐにアニメーションが開始しました。
Storyborad要素のBeginTimeプロパティを使用すると開始時間を遅らせることができます。
BeginTimeプロパティには
時間:分:秒
の書式で、アニメーションが開始される時間を指定することができます。
3秒後に開始されるようにする場合はBeginTimeに”0:0:3″を指定します。
以下にXAMLのコードを示します。
XAMLの例
<Page x:Class="Step23.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Step23" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Loaded="Page_Loaded"> <Page.Resources> <Storyboard x:Key="storyBoard"> <DoubleAnimation Storyboard.TargetName="txbFont" Storyboard.TargetProperty="FontSize" EnableDependentAnimation="True" From="10" To="50" Duration="0:0:1" RepeatBehavior="5x" BeginTime="0:0:3"/> </Storyboard> </Page.Resources> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <TextBlock x:Name="txbFont" HorizontalAlignment="Left" Margin="103,97,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/> <Button Content="Button" HorizontalAlignment="Left" Margin="100,48,0,0" VerticalAlignment="Top" Click="Button_Click"/> </Grid> </Page>
Please follow and like us:
コメント