winrt 页面进入动画
private async void DoAnimistion()
{
Storyboard storyboard = new Storyboard();
using (IEnumerator<DependencyObject> enumerator = stack.Children.ToList().GetEnumerator())
//此处的stack是一个StackPanel,我要对它的子元素做动画
{
Random random = new Random();
TimeSpan time = TimeSpan.FromSeconds(0.0);
var ts = TimeSpan.FromMilliseconds(80.0);
double angle = -120.0;
while (enumerator.MoveNext())
{ //double num = random.Next(200, 500); FrameworkElement frameworkElement = (FrameworkElement)enumerator.Current; DoubleAnimationUsingKeyFrames xdoubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
xdoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time), ));
xdoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time.Add(TimeSpan.FromSeconds(0.3))), ));
Storyboard.SetTarget(xdoubleAnimationUsingKeyFrames, frameworkElement);
Storyboard.SetTargetName(xdoubleAnimationUsingKeyFrames, frameworkElement.Name);
Storyboard.SetTargetProperty(xdoubleAnimationUsingKeyFrames, TargetProperty.RenderTransformTranslateX);
storyboard.Children.Add(xdoubleAnimationUsingKeyFrames); DoubleAnimationUsingKeyFrames ydoubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
ydoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time), angle));
ydoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time.Add(TimeSpan.FromSeconds(0.3))), ));
Storyboard.SetTarget(ydoubleAnimationUsingKeyFrames, frameworkElement);
Storyboard.SetTargetName(ydoubleAnimationUsingKeyFrames, frameworkElement.Name);
Storyboard.SetTargetProperty(ydoubleAnimationUsingKeyFrames, TargetProperty.ProjectionRotationY);
storyboard.Children.Add(ydoubleAnimationUsingKeyFrames); var num3 = -1.0 * (Math.Tan(DegreesToRadians(angle)) * frameworkElement.ActualWidth);
num3 += frameworkElement.ActualWidth;
DoubleAnimationUsingKeyFrames zdoubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
zdoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time), num3));
zdoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time.Add(TimeSpan.FromSeconds(0.3))), ));
Storyboard.SetTarget(zdoubleAnimationUsingKeyFrames, frameworkElement);
Storyboard.SetTargetName(zdoubleAnimationUsingKeyFrames, frameworkElement.Name);
Storyboard.SetTargetProperty(zdoubleAnimationUsingKeyFrames, TargetProperty.ProjectionGlobalOffsetZ);
storyboard.Children.Add(zdoubleAnimationUsingKeyFrames); time = time.Add(ts);
}
}
storyboard.Begin();
}
public static double DegreesToRadians(double degrees)
{
return degrees * 2.0 * 3.1415926535897931 / 360.0;
}
winrt 页面进入动画的更多相关文章
- (原)android中的动画(三)之动画监听&页面切换动画
1.动画也可以设置监听事件,例如在动画结束时需要执行某操作 把要执行的代码写在onAnimationEnd()回调方法中即可: anim.setAnimationListener(new Animat ...
- HTML页面的动画的制作及性能
原文:HTML页面的动画的制作及性能 WEB页面的动画的制作及性能 简介 目前WEB页面做动画的方式大的分两种1.JS间隔时间不断修改元素属性值,这也是CSS3出来前常用的做法,貌似也是唯一的做法.2 ...
- iOS页面切换动画实现方式。
iOS页面切换动画实现方式. 1.使用UIView animateWithDuration:animations:completion方法 Java代码 [UIView animateWithDura ...
- QtQuick多页面切换、多页面切换动画、多个qml文件数据交互
一.QtQuick多页面切换方法 (1)“隐藏法” 前一个视图visible设为false或者透明度opacity设为0,相当于“隐藏”了,实际还存在: 要显示的视图visible设为true或者透明 ...
- demo: 全页面CSS3动画的一个参考例子
全页面CSS3动画的一个参考例子: http://wow.blizzard.cn/wow/wod-achievement/ 魔兽的一个活动页 第二页.第三页,文字进入页面 <script src ...
- (私人收藏)64个精致的页面loadinggif动画
64个精致的页面loadinggif动画 https://pan.baidu.com/s/18bfktLZ90jQ7l2kSmMv-dgnmm5
- 利用CSS3实现div页面淡入动画特效
利用CSS3实现页面淡入动画特效 摘要 利用CSS3动画属性"@keyframes "可实现一些动态特效,具体语法和参数可以网上自行学习.这篇文章主要是实践应用一下这个动画属性 ...
- 利用CSS3实现页面淡入动画特效
利用CSS3动画属性"@keyframes "可实现一些动态特效,具体语法和参数可以网上自行学习.这篇文章主要是实践应用一下这个动画属性,实现页面淡入特效,在火狐24版.chrom ...
- Windows Phone使用sliverlight toolkit实现页面切换动画效果
使用应用时,好多app在页面切换的时候都有一个动画效果,感觉很炫,也大大增加了用户体验,怎么实现呢? 界面的切换,可以用Windows Phone Toolkit中的TransitionService ...
随机推荐
- Linux服务器管理: 系统管理:系统资源查看
vmstat 命令: 查看或监控系统资源 [root@localhostA1 ~]# vmstat procs -----------memory---------- ---swap-- -----i ...
- 一次关于使用status作为变量引发的bug及思考
这个bug出现在一年前,当时自己大学还没毕业,刚刚进入一家公司实习.那个时候还没有用seajs或者requirejs那样的模块化管理的库,也没有用一个自执行的函数将要执行的代码包裹起来,于是bug就在 ...
- 低版本IE浏览器 input元素出现叉叉的情况
都说是IE10之上的浏览器才有这个问题,恰巧我IE10之上都没有问题,反而是低版本的浏览器出现了这个问题.作为一个凭证,我先放一张图片在这里面. 之前无意中解决过这个问题,如今复现确实是没有解决,网上 ...
- 关于360的META设置,强制使用极速模式
我的网站,为了使360浏览器打开时默认为极速模式,给用户良好的体验!避免网页由于细节而导致页面布局错乱~ <!DOCTYPE HTML> <html> <head> ...
- hdu1757 A Simple Math Problem
Problem Description Lele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x > ...
- git学习教程
猴子都能懂的GIT入门 http://backlogtool.com/git-guide/cn/ 廖雪峰的Git教程 http://www.liaoxuefeng.com/wiki/001373951 ...
- 支付安全基础 —— HTTPS的故事
本文主要讲述了HTTPS的基本原理,通过HTTPS握手过程.证书链.中间人攻击.CA机构等问题,详细解释了百付宝系统中用到的HTTPS安全知识,同时,介绍了如何查看www.baifubao.com的 ...
- C/C++多种方法获取文件大小(转)
源码下载:点击下载 源码如下: #include <iostream> #include <io.h> #include <sys\stat.h> #include ...
- Android 网络请求框架android-async-http问题
今天通过接口请求服务器的一些app数据,发现一个很奇怪的问题,请求一个链接的时候,通常在第一次请求发起的时候没有什么问题,能很快的拿到数据,但是 往后再去请求的时候就会等待很久,而且最后会请求失败,一 ...
- HDU 4803 Poor Warehouse Keeper
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4803 解题报告:有一个记录器,一共有两个按钮,还有两行屏幕显示,第一行的屏幕显示的是数目,第二行的屏幕 ...