Metro APP在C#中使用2D动画 [英] Metro APP siple 2D animation in C#
本文介绍了Metro APP在C#中使用2D动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
如何使用C#为Metro APp做简单的动画。我有一套png..wen我触摸它应该通过使用所有的动画来动画png's。
任何帮助plz ...
How to do simple animation for Metro APp using C#.Iam having set of png..wen i touch it should get animated by using all the png's.
Any help plz...
推荐答案
//这里myRectangle是一个矩形Xaml页面。
//创建变换
TranslateTransform moveTransform = new TranslateTransform();
moveTransform.X = 0;
moveTransform.Y = 0;
myRectangle.RenderTransform = moveTransform;
//创建一个2秒的持续时间。
持续时间=新的持续时间(TimeSpan.FromSeconds(1.0));
//创建两个DoubleAnimations并设置它们的属性。
DoubleAnimation myDoubleAnimationX = new DoubleAnimation();
Storyboard sb = new Storyboard();
sb.Duration = duration;
sb.Children.Add(myDoubleAnimationX);
Storyboard.SetTarget(myDoubleAnimationX) ,moveTransform);
Storyboard.SetTargetProperty(myDoubleAnimationX,X);
myDoubleAnimationX.To = 0;
myDoubleAnimationX.From = 340;
sb.Begin();
谢谢,
Bilaal
// Here myRectangle is a Rectangle Xaml Page.
// Create the transform
TranslateTransform moveTransform = new TranslateTransform();
moveTransform.X = 0;
moveTransform.Y = 0;
myRectangle.RenderTransform = moveTransform;
// Create a duration of 2 seconds.
Duration duration = new Duration(TimeSpan.FromSeconds(1.0));
// Create two DoubleAnimations and set their properties.
DoubleAnimation myDoubleAnimationX = new DoubleAnimation();
Storyboard sb = new Storyboard();
sb.Duration = duration;
sb.Children.Add(myDoubleAnimationX);
Storyboard.SetTarget(myDoubleAnimationX, moveTransform);
Storyboard.SetTargetProperty(myDoubleAnimationX, "X");
myDoubleAnimationX.To = 0;
myDoubleAnimationX.From = 340;
sb.Begin();
Thanks,
Bilaal
这篇关于Metro APP在C#中使用2D动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文