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文档常见后缀名
echo "Start bakup mdsoss Source code ..."_Name="templatecdr_src_"`date +%Y%m%d%H ...
- 绕过HR破门而入的求职智慧
以往我们在网上看到的很多求职文章或指导性纲领,譬如啥自信.做功课.良好形象.华丽的简历.工作经验.口才啥的,其实到了21世纪尤其是互联网高速发展的今天,前面这些技巧就显得无比空洞: 1.因为自信谁都可 ...
- [译]在AngularJS中何时应该使用Directives,Controllers或者Service
原文: http://kirkbushell.me/when-to-use-directives-controllers-or-services-in-angular/ Services Servic ...
- 2013长沙 G Graph Reconstruction (Havel-Hakimi定理)
Graph Reconstruction Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Let there ...
- Mac Pro Office Word 2011 个性化设置
操作系统:Mac Pro OS X 10.11.5 1.常用的几个操作: (1).视图 -> 功能区 (2).视图 -> 打印版式 (3).视图 -> 大纲 (4).视图 -> ...
- springMVC-1
1.springMVC请求由前端到后端的流程 2.配置过程 (1)需要的jar包 spring-aop.jar spring-beans.jar spring-context.jar spring-c ...
- memcache安装
windows下访问 http://pecl.php.net/package/memcache/3.0.8/windows 下载对应版本memcache的dll文件添加到php目录ext下 PHP.i ...
- WWDC15 Session笔记 - Xcode 7 UI 测试初窥
https://onevcat.com/2015/09/ui-testing/ WWDC15 Session笔记 - Xcode 7 UI 测试初窥 Unit Test 在 iOS 开发中已经有足够多 ...
- Two Strings Are Anagrams
Write a method anagram(s,t) to decide if two strings are anagrams or not. 判断两个字符串里的字符是否相同,也就是是否能够通过改 ...
- leetcode 33. Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...