Анимацию - вот так:| Код | <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication8.MainWindow" x:Name="Window" Title="MainWindow" Width="640" Height="480"> <Window.Resources> <Storyboard x:Key="TextAnimation"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="textBlock"> <EasingDoubleKeyFrame KeyTime="0" Value="0"/> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-360"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="textBlock"> <EasingDoubleKeyFrame KeyTime="0" Value="1"/> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="3"/> <EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Window.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"/> <EventTrigger RoutedEvent="Control.MouseDoubleClick" SourceName="button"> <BeginStoryboard x:Name="TextAnimation_BeginStoryboard" Storyboard="{StaticResource TextAnimation}"/> </EventTrigger> </Window.Triggers>
<Grid x:Name="LayoutRoot"> <TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="Animated Text" RenderTransformOrigin="0.5,0.5" Width="200" Height="200" HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </TextBlock.RenderTransform> </TextBlock> <Button x:Name="button" Content="My Button" Width="100" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </Window>
|
|