WPF动画 storyboard_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > WPF动画 storyboard

WPF动画 storyboard

 2014/6/5 14:52:14  奮鬥的QB  博客园  我要评论(0)
  • 摘要:<Windowx:Class="StoryBoard.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow"Height="350"Width="525"Foreground="{x:Null
  • 标签:

<Window x:Class="StoryBoard.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Foreground="{x:Null}" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True" Background="{x:Null}" Topmost="True">
<Window.Resources>
<Storyboard x:Key="fanzhuan">
<!--翻转位置 0.5,0.5表示中点翻转-->
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="grid">
<EasingPointKeyFrame KeyTime="0" Value="0.5,0.5"/>
</PointAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="grid">
<!--KeyTime表示时间间隔,value表示从哪里翻转-1表示反面 -0.8表示侧一点-->
<EasingDoubleKeyFrame KeyTime="0" Value="-1">
<EasingDoubleKeyFrame.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
<!--0:0:1是timespan 翻转完全的时间间隔-->
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource fanzhuan}"/>
</EventTrigger>
</Window.Triggers>

<Grid x:Name="grid" >
<!--必须需要能翻转属性-->
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.RenderTransform>
<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="Resources/6.jpg"/>
</Grid.Background>
<Button Content="Button" Name="btn1" HorizontalAlignment="Left" Margin="338,153,0,0" VerticalAlignment="Top" Width="75">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard Storyboard="{StaticResource fanzhuan}"/>
</EventTrigger>

</Button.Triggers>
</Button>
<Button Content="Button" Click="Button_Click" HorizontalAlignment="Left" Margin="164,218,0,0" VerticalAlignment="Top" Width="75"/>
</Grid>
</Window>

  • 相关文章
发表评论
用户名: 匿名