今回はアニメーションの時間を変更してみましょう。
前回のサンプルコードを元に修正を加えていきます。
アニメーションが行われる時間はSroryBord要素のDuration属性で設定します。
Duration属性に指定する値は
時間:分:秒
という書式で指定をします。
フォントサイズを5秒間で変化させるには、Durationには”0:0:5″を指定します。
以下に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:5"/>
</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:

コメント