DispatcherTimer を使用してアニメーションを表示するのは非常に予測不可能であるため、停止したいと考えています。代わりに、コントロールをアニメーション化するための最良かつ最も効率的な方法であるため、ストーリーボードの使用を開始したいと考えています。
チュートリアルを検索してみましたが、残念ながらまだ見つかっていません。
どこから始めればよいか教えてください。たとえば、「画面上で画像を移動する」と「複数の画像を回転させながら同時に移動する」などです。
DispatcherTimer を使用してアニメーションを表示するのは非常に予測不可能であるため、停止したいと考えています。代わりに、コントロールをアニメーション化するための最良かつ最も効率的な方法であるため、ストーリーボードの使用を開始したいと考えています。
チュートリアルを検索してみましたが、残念ながらまだ見つかっていません。
どこから始めればよいか教えてください。たとえば、「画面上で画像を移動する」と「複数の画像を回転させながら同時に移動する」などです。
Windows Phone 7 のストーリーボード アニメーションに関しては、多くの情報が公開されています。いくつかのリンクを次に示します。
http://msdn.microsoft.com/en-us/library/system.windows.media.animation.storyboard(v=vs.95).aspx
http://www.silverlight.net/learn/creating-ui/animation-and-easing/animations-(silverlight-quickstart )
ここにあなたが始めるためのいくつかのコードがあります
これにより、単純な長方形がアニメーション化され、画面上で前後に移動します。
<phone:PhoneApplicationPage
x:Class="PhoneApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Rectangle x:Name="rect" Height="25" Width="25" Fill="Red" HorizontalAlignment="Left" VerticalAlignment="Top">
<Rectangle.RenderTransform>
<TranslateTransform x:Name="transform" />
</Rectangle.RenderTransform>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="transform"
Storyboard.TargetProperty="X"
From="0" To="100" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</Grid>
</Grid>
</phone:PhoneApplicationPage>