So I learned how to make images expand and contract (x,y). Is there a way for me to rotate them?
I have this code for expa开发者_运维百科nding and contracting images in a sexy manner. I'd like to add a little rotation in there, just to make the image pop up, you know?
Where/how do I add rotation animations to control?
<Style.Triggers>
<EventTrigger RoutedEvent="Image.MouseEnter">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.25" From="1" To="1.2" AutoReverse="True"
Storyboard.TargetProperty="RenderTransform.ScaleX"/>
<DoubleAnimation Duration="0:0:0.1" From="1" To="1.2" AutoReverse="True"
Storyboard.TargetProperty="RenderTransform.ScaleY"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
You need to set RenderTransform
to a TransformGroup
containing a RotateTransform
and a ScaleTransform
, then animate the RotateTransform
's Angle
property.
Download Blend and use that. You can create storyboards and rotate you objects with that. It will generate all the XAML for you... you can learn that way
Coding animations kinda defeats the point of WPF
精彩评论