1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<Canvas>
<Canvas.Resources>
<Storyboard x:Name="myStoryboard">
<!-- Animate the TranslateTransform's X property
from 0 to 350, then 50,
then 200 over 10 seconds. -->
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="MyAnimatedTranslateTransform"
Storyboard.TargetProperty="Angle"
Duration="0:0:28" FillBehavior="Stop" SpeedRatio="{Binding ElementName=Sliders,Path=Value}" >
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:1" />
<LinearDoubleKeyFrame Value="180" KeyTime="0:0:2" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:3" />
<LinearDoubleKeyFrame Value="360" KeyTime="0:0:4" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:5" />
<LinearDoubleKeyFrame Value="180" KeyTime="0:0:6" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:7" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:8" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:9" />
<LinearDoubleKeyFrame Value="180" KeyTime="0:0:10" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:11" />
<LinearDoubleKeyFrame Value="360" KeyTime="0:0:12" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:13" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:14" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:15" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:17" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:18" />
<LinearDoubleKeyFrame Value="360" KeyTime="0:0:19" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:20" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:21" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:22" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:23" />
<LinearDoubleKeyFrame Value="180" KeyTime="0:0:24" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:25" />
<LinearDoubleKeyFrame Value="360" KeyTime="0:0:26" />
<LinearDoubleKeyFrame Value="250" KeyTime="0:0:27" />
<LinearDoubleKeyFrame Value="90" KeyTime="0:0:28" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Canvas.Resources>
<Rectangle MouseLeftButtonDown="Mouse_Clicked"
Name="rec1" RenderTransformOrigin="0,0" Fill="Blue" Width="106" Height="106" Canvas.Left="200" Canvas.Top="200">
<Rectangle.RenderTransform>
<RotateTransform
x:Name="MyAnimatedTranslateTransform"
Angle="0" />
</Rectangle.RenderTransform>
</Rectangle>
<Slider Canvas.Left="80" Canvas.Top="399" Height="84" x:Name="Sliders" Width="323"
Maximum="100" Minimum="0"/>
</Canvas> |
Partager