• WPF动画 storyboard


    <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>

  • 相关阅读:
    解压bz2包
    Linux获取客户端IP
    出现身份验证错误,要求的函数不受支持,远程计算机
    Ubuntu16.04.4 编译安装ssldump1.1
    windows远程桌面复制不了文件
    MySQL空间数据操作:GeomFromText()和astext()函数报错解决
    mysql中geometry类型的简单使用
    response header的Content-Disposition的inline的作用
    jooq的LocalDateTime转化成LocalDate
    java8 LocalDateTime时间格式化
  • 原文地址:https://www.cnblogs.com/JohnnyBao/p/3769952.html
Copyright © 2020-2023  润新知