从Flash到Silverlight进阶教程
Tweener
在flash中有一个Tweener类,通过这个类我们可以通过代码来创建一些动画效果,这里将要介绍一下在Silverlight中如何像在flash中运用Tweener类一样来创建动画效果。
例子中使用的Flash Tweener类为:http://code.google.com/p/tweener/


















































了解flash中Tween类的朋友我就不用多说,只要用上一次便会爱上她。flash中的Tween已经发展了很长的时间,功能也非常的强大,可以用来做很多很玄的效果。这么好的东西在Silverlight中当然也会有的,其名字为:agTweener 项目地址:www.codeplex.com/agTweener/ 当然了他还刚刚开始远没有flash中的强大。
看看要实现同样的效果在Silverlight中该怎么样做。
新建项目,参考
Silverlight初级教程-建立silverlight项目 。
调整舞台布局和Flash一样,参考
Silverlight初级教程-绘图布局 。
在flash中引用了Tweener类库
import caurina.transitions.Tweener;
在Silverlight中也是一样,需要引用Tweener类库。右键点击新建立的解决方案选择Add->Existing Project 选中刚才下载agTweener项目

右键点击Silverlight项目选择Add Reference

在弹出的对话框中选择Project选项卡,选中agTweener项目

好准备工作做好了。
打开Page.xaml.cs
这里说明下"LayoutRoot"为silverlight默认的根容器,这个名字一般不会去改动他。
修改page类为如下代码。















































































效果如下:
作者:nasa
出处:nasa.cnblogs.com
联系:nasa_wz@hotmail.com
QQ:12446006
转载请保留本博客链接