<Window
...
WindowStyle="None"
AllowsTransparency="True"
RenderTransformOrigin="0.5, 0.5">
<Window.Resources>
<Storyboard x:Key="WinBootAnimation">
<DoubleAnimation Storyboard.TargetProperty="(RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
From="0" To="1" Duration="0:0:1" DecelerationRatio="0.3" />
<DoubleAnimation Storyboard.TargetProperty="(RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
From="0" To="1" Duration="0:0:1" DecelerationRatio="0.3" />
<DoubleAnimation Duration="0:0:0.45" Storyboard.TargetProperty="Opacity" From="0" To="1" />
</Storyboard>
</Window.Resources>
<Window.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<RotateTransform/>
</TransformGroup>
</Window.RenderTransform>
<Window.Triggers>
<EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard Storyboard="{StaticResource WinBootAnimation}">
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Window.Triggers>

效果:

  1. Storyboard.TargetProperty 的值可以写成 (RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX) 或 RenderTransform.Children[0].ScaleX,但 ScaleTransform.ScaleX 更直观且会有语法解析错误提示;
  2. ScaleX 、ScaleY 的减速 DecelerationRatio 设置为 0.3,视觉效果比默认的 0 要更平滑;
  3. 同样从 0 到 1 的,让 Opacity 的动画时间比 ScaleX 、ScaleY 的减少一半,视觉效果也更平滑;
  4. Window.AllowsTransparency 为 True 时,Window.WindowStyle 必须为 None,可以通过添加按钮实现关闭、最小化等功能。这里将 RenderTransformOrigin 设置为 0.5 0.5 可以看到窗口从中间向四周放大。

WPF 基础 - Window 启动动画的更多相关文章

  1. [WPF自定义控件]?Window(窗体)的UI元素及行为

    原文:[WPF自定义控件]?Window(窗体)的UI元素及行为 1. 前言 本来打算写一篇<自定义Window>的文章,但写着写着发觉内容太多,所以还是把使用WindowChrome自定 ...

  2. WPF基础到企业应用系列6——布局全接触

    本文转自:http://knightswarrior.blog.51cto.com/1792698/365351 一. 摘要 首先很高兴这个系列能得到大家的关注和支持,这段时间一直在研究Windows ...

  3. WPF 3D 平移模型+动画(桥梁检测系统)

    原文:WPF 3D 平移模型+动画(桥梁检测系统) 关于WPF 3D,网上有很多旋转的例子,但是关于平移的例子并不是太多.本文并非WPF 3D扫盲篇,因此需要对WPF 3D有一定了解,至少知道View ...

  4. .NET CORE(C#) WPF 值得推荐的动画菜单设计

    微信公众号:Dotnet9,网站:Dotnet9,问题或建议:请网站留言, 如果对您有所帮助:欢迎赞赏. .NET CORE(C#) WPF 值得推荐的动画菜单设计 阅读导航 本文背景 代码实现 本文 ...

  5. WPF 基础到企业应用系列索引

    转自:http://www.cnblogs.com/zenghongliang/archive/2010/07/09/1774141.html WPF 基础到企业应用系列索引 WPF 基础到企业应用系 ...

  6. WPF笔记(1.1 WPF基础)——Hello,WPF!

    原文:WPF笔记(1.1 WPF基础)--Hello,WPF! Example 1-1. Minimal C# WPF application// MyApp.csusing System;using ...

  7. 【WPF】两则动画效果

    原文:[WPF]两则动画效果 引言 利用WPF的动画可以轻而易举的实现各种各样的特效,如擦除,滑动进入等,先看两个效果图 第一个效果 这个动画其实利用了OpacityMask和LinearGradie ...

  8. WPF加载等待动画

    原文:WPF加载等待动画 原文地址:https://www.codeproject.com/Articles/57984/WPF-Loading-Wait-Adorner 界面遮罩 <UserC ...

  9. phonegap配置启动动画

    以下有2种方式 1 主Active中 onCreate函数里添加代码 2 config.xml文件进行配置(对通过命令行模式下cordova命令行生成的可行) 确保自己安装了SplashScreen插 ...

随机推荐

  1. Filebeat 日志收集

    Filebeat 介绍 Filebeat 安装 # 上传代码包 [root@redis03 ~]# rz filebeat-6.6.0-x86_64.rpm # 安装 [root@redis03 ~] ...

  2. SVG path d Attribute

    Scalable Vector Graphics (SVG) 1.1 (Second Edition) W3C Recommendation 16 August 2011 http://www.w3. ...

  3. Get your site working on Google Search Console , 在 Google Search Console中运行您的网站, Google Search Console

    1 1 https://support.google.com/webmasters/topic/4564315? Search Console Help SEARCH CONSOLEHELP FORU ...

  4. Linux Schedule Cron All In One

    Linux Schedule Cron All In One 定时任务 / 定时器 GitHub Actions Scheduled events Cron syntax has five field ...

  5. HTML5 动效

    HTML5 动效 motion graphics toolbelt for the web https://github.com/xgqfrms/mojs A collection of loadin ...

  6. 如何给 GitHub 添加 SSH key, 如何生成 SSH key 详细图文教程!

    如何给 GitHub 添加  SSH key, 如何生成  SSH key 详细图文教程! 一. 生成  SSH key https://ide.c9.io/xgqfrms/ 创建一个空项目:(或使用 ...

  7. Taro 框架实现原理

    Taro 框架实现原理 小程序 H5 RN Web 多端框架 Taro 1.x & Taro 2.x 编译型架构, 语法编译转换 Taro 1/2 属于编译型架构,主要通过对类 React 代 ...

  8. Redis in Action

    Redis in Action Redis REmote DIctionary Server(Redis) Redis 是一种开放源代码(BSD许可)的内存中数据结构存储,用作数据库,缓存和消息代理. ...

  9. website URL & UTM

    website URL & UTM UTM user track message utm_source https://zhuanlan.zhihu.com/p/143473571?utm_s ...

  10. free food icons

    free food icons food icons Chinese foods https://www.flaticon.com/categories/food-and-restaurant htt ...