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 ...
随机推荐
- ubuntu用apt-get安装memcache
转自:http://yangfutao2000.blog.163.com/blog/static/12162588201151635856858/ 先安装服务器端: apt-get install m ...
- 基础知识系列☞IList ←vs→ List
原文地址→http://www.cnblogs.com/zbphot/archive/2011/11/04/2235933.html IList接口→表示可按照索引单独访问的对象的非泛型集合. ILi ...
- nyoj 91 阶乘之和(贪心)
阶乘之和 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述 给你一个非负数整数n,判断n是不是一些数(这些数不允许重复使用,且为正数)的阶乘之和,如9=1!+2!+3! ...
- UESTC 1851 Kings on a Chessboard
状压DP... Kings on a Chessboard Time Limit: 10000ms Memory Limit: 65535KB This problem will be judged ...
- UI第五节——手势
#import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL ...
- 7-RandomAccessFile 随机流
package com.io; import java.io.File; import java.io.FileNotFoundException; import java.io.IOExceptio ...
- JS写的多级联select,如何取值
var $ = function (id) { return "string" == typeof id ? document.getElementById(id) : id ...
- nginx反向代理、动静分离
环境:根据http://www.cnblogs.com/zzzhfo/p/6032095.html配置 方法一:根据目录实现动静分离 在web01创建image并上传一张图片作为静态页面 [root@ ...
- linux下好用的软件
搜狗输入法 http://pinyin.sogou.com/linux/ wps http://community.wps.cn/download/ 浏览器 chrome or FireFox or ...
- linux 下安装tomcat
1.把安装包放到 tomcat的目录, 2.然后 解压 tar -zxvf apache-tomcat-7.0.70.tar.gz 解压. 3.然后启动tomcat