zoukankan      html  css  js  c++  java
  • Animation in Windows 8 apps

    在Windows 8 App里边的动画和在silverlight里边还有稍微的区别, 如代码:

    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Media.Animation;
    using Windows.UI.Xaml.Controls;
    
            protected void DemoAnimation()
            {
                Duration m_Dur = new Duration(TimeSpan.FromSeconds(4));
                Storyboard sb = new Storyboard();
                sb.Duration = m_Dur;
    
                DoubleAnimation topAnimation = new DoubleAnimation();
                topAnimation.Duration = m_Dur;
                DoubleAnimation leftAnimation = new DoubleAnimation();
                leftAnimation.Duration = m_Dur;
    
                Storyboard.SetTarget(topAnimation, myPictureCanvas);
                Storyboard.SetTargetProperty(topAnimation, "(Canvas.Top)");
                Storyboard.SetTarget(leftAnimation, myPictureCanvas);
                Storyboard.SetTargetProperty(leftAnimation, "(Canvas.Left)");
                topAnimation.EnableDependentAnimation = true;
                leftAnimation.EnableDependentAnimation = true;
                topAnimation.From = 0;
                leftAnimation.From = 0;
                topAnimation.To = 500;
                leftAnimation.To = 500;
    
    
                DoubleAnimation heightAnimation = new DoubleAnimation();
                heightAnimation.Duration = m_Dur;
                DoubleAnimation widthAnimation = new DoubleAnimation();
                widthAnimation.Duration = m_Dur;
    
                Storyboard.SetTarget(heightAnimation, myPictureCanvas);
                Storyboard.SetTargetProperty(heightAnimation, "(Canvas.Height)");
                Storyboard.SetTarget(widthAnimation, myPictureCanvas);
                Storyboard.SetTargetProperty(widthAnimation, "(Canvas.Width)");
                heightAnimation.EnableDependentAnimation = true;
                widthAnimation.EnableDependentAnimation = true;
                heightAnimation.From = 50;
                widthAnimation.From = 50;
                heightAnimation.To = 500;
                widthAnimation.To = 500;
                sb.Children.Add(heightAnimation);
                sb.Children.Add(widthAnimation);
    
                sb.Children.Add(topAnimation);
                sb.Children.Add(leftAnimation);
                sb.Begin();
            }
  • 相关阅读:
    Python3.3 学习笔记2 模块
    Python3.3 学习笔记4 函数 input & print
    Python3.3 学习笔记6 文件
    Python3.3 学习笔记8 函数
    Python3.3 学习笔记5 异常处理
    Python3.3 学习笔记9 类
    Python3.3 学习笔记10 图形化界面
    Python3.3 学习笔记1 初步安装
    Python3.3 学习笔记3 数据类型和运算
    Python3.3 学习笔记4 函数 内置和其他一些函数
  • 原文地址:https://www.cnblogs.com/qixue/p/2856579.html
Copyright © 2011-2022 走看看