WPF 翻转动画实现(转)

这个动画本来很简单的,从论坛上看到了,就放在这里,省的以后做了

[csharp] view plaincopyprint?

  1. <Window x:Class="WPFTransformWindows.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="MainWindow" Height="350" Width="525" Foreground="{x:Null}" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True" Background="{x:Null}" Topmost="True">
  5. <Window.Resources>
  6. <Storyboard x:Key="fanzhuan">
  7. <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="grid">
  8. <EasingPointKeyFrame KeyTime="0" Value="0.5,0.5"/>
  9. </PointAnimationUsingKeyFrames>
  10. <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="grid">
  11. <EasingDoubleKeyFrame KeyTime="0" Value="-1">
  12. <EasingDoubleKeyFrame.EasingFunction>
  13. <CubicEase EasingMode="EaseOut"/>
  14. </EasingDoubleKeyFrame.EasingFunction>
  15. </EasingDoubleKeyFrame>
  16. <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1">
  17. <EasingDoubleKeyFrame.EasingFunction>
  18. <CubicEase EasingMode="EaseOut"/>
  19. </EasingDoubleKeyFrame.EasingFunction>
  20. </EasingDoubleKeyFrame>
  21. </DoubleAnimationUsingKeyFrames>
  22. </Storyboard>
  23. </Window.Resources>
  24. <Window.Triggers>
  25. <EventTrigger RoutedEvent="FrameworkElement.Loaded">
  26. <BeginStoryboard Storyboard="{StaticResource fanzhuan}"/>
  27. </EventTrigger>
  28. </Window.Triggers>
  29. <Grid x:Name="grid" MouseLeftButtonDown="grid_MouseLeftButtonDown_1">
  30. <Grid.RenderTransform>
  31. <TransformGroup>
  32. <ScaleTransform/>
  33. <SkewTransform/>
  34. <RotateTransform/>
  35. <TranslateTransform/>
  36. </TransformGroup>
  37. </Grid.RenderTransform>
  38. <Grid.Background>
  39. <ImageBrush ImageSource="6.jpg" Stretch="UniformToFill"/>
  40. </Grid.Background>
原文地址:https://www.cnblogs.com/aoldman/p/2777549.html