silverlight   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Silverlight 动画效果1 -- 旋转大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

Silverlight 动画效果1 -- 旋转 效果如下: 代码如下: Storyboard sb,sb2; PlaneProjection pp; private void button1_Click(object sender, RoutedEventArgs E) { if (this.Projectio

Silverlight 动画效果1 -- 旋转

效果如下:

Silverlight 动画效果1 -- 旋转

代码如下:

        Storyboard sb,sb2;
        PlaneProjection pp;
        private void button1_Click(object sender,RoutedEventArgs E)
        {
            if (this.Projection == null)
            {
                this.Projection= pp = new PlaneProjection
                {
                    RotationY=0    //--Y轴角度为0
                };
            }
            if (sb == null)
            {
                sb = new Storyboard();
                DoubleAnimation da = new DoubleAnimation();
                Storyboard.SetTarget(da,this.projection);
                Storyboard.SetTargetProperty(da,new PropertyPath("RotationY"));//--旋转Y轴
                sb.Children.Add(da);
                da.From = 0;//--从0度开始
                da.To = 90; //--旋转90度
                da.Duration = TimeSpan.FromSeconds(0.5); //时间0.5s
                sb.Completed += new EventHandler(sb_Completed);//转完一半开始别一半
            }
            sb.begin();//开始
            
        }

        void sb_Completed(object sender,EventArgs E)
        {
            if (sb2 == null)
            {
                sb2 = new Storyboard();
                DoubleAnimation da = new DoubleAnimation();
                Storyboard.SetTarget(da,new PropertyPath("RotationY"));
                sb2.Children.Add(da);
                da.From = 270;//从270度开始
                da.To = 360;//到360度
                da.Duration = TimeSpan.FromSeconds(0.5);
                sb2.Completed += new EventHandler(sb2_Completed);
            }
            this.title = this.title == "测试一" ? "测试二" : "测试一";
            sb2.begin();
            
        }

        void sb2_Completed(object sender,EventArgs E)
        {
            
        }

大佬总结

以上是大佬教程为你收集整理的Silverlight 动画效果1 -- 旋转全部内容,希望文章能够帮你解决Silverlight 动画效果1 -- 旋转所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。