uwp 中的动画
xml
---------------------------------------
<Page
x:Class="MyApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Path HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" Height="300" Stretch="Uniform" Fill="Yellow" RenderTransformOrigin="0.5,0.5">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="20"/>
<EllipseGeometry Center="50,50" RadiusX="20" RadiusY="50"/>
</GeometryGroup>
</Path.Data>
<Path.RenderTransform>
<RotateTransform x:Name="rttrf" Angle="0"/>
</Path.RenderTransform>
</Path>
</Grid>
</Page>
C# code
-------------------------------------------
public sealed partial class MainPage : Page
{
Storyboard m_storyboard = null;
public MainPage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
// 初始化演示图板
m_storyboard = new Storyboard();
// 定义时间线
DoubleAnimation da = new DoubleAnimation();
da.Duration = TimeSpan.FromSeconds(2d); //时间线持续时间
da.From = 0d; //初始值
da.To = 360d; //最终值
// 设置为无限循环播放
da.RepeatBehavior = RepeatBehavior.Forever;
// 将时间线与RotateTransform对象关联
Storyboard.SetTarget(da, rttrf);
Storyboard.SetTargetProperty(da, "Angle");
// 将时间线加入Storyboard的时间线集合中
m_storyboard.Children.Add(da);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// 开始播放动画
m_storyboard.Begin();
}
}
最新文章
- 让IE8在win7下面能显示使用window.showmodaldialog弹出窗口的地址状态栏
- Linux中设置定期备份oracle数据库
- chrome表单自动填充去掉input黄色背景解决方案
- 实例化bean的三种方式
- HDU 5776 sum (模拟)
- 源代码jar包中中文注释乱码
- JS call和apply用法(转)
- 应用程序缓存 AppCache
- Chapter 1 Securing Your Server and Network(3):使用托管服务帐号
- Git 命令速查表
- Openjudge-计算概论(A)-简单算术表达式求值
- SpringBoot简单打包部署(附工程)
- java 根据Url下载对应的文件到指定位置,读txt文件获取url
- Java 高级框架——Mybatis(一)
- CentOS 7 设置默认进入图形界面或文本界面
- pytorch做seq2seq注意力模型的翻译
- Ubuntu下安装open-falcon-v0.2.1
- ERP产品采购申请管理(三十八)
- 解决ORA-00257: 归档程序错误。在释放之前仅限于内部连接
- Python Web学习笔记之递归和迭代的区别