zoukankan      html  css  js  c++  java
  • 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), 380)); xdoubleAnimationUsingKeyFrames.KeyFrames.Add(CreateKeyFrame(KeyTime.FromTimeSpan(time.Add(TimeSpan.FromSeconds(0.3))), 0)); 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))), 0)); 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))), 0)); 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;
            }
  • 相关阅读:
    python之基础知识篇
    OpenGL 着色器管理类 Shader
    OpenGL 彩色三角形
    OpenGL 你好,三角形 练习一 二 三
    OpenGL 矩阵绘画
    OpenGL 第一个三角形!!!!
    OpenGL 读取,使用 .vert .frag 着色器 文件 C++
    C++ 一定要使用strcpy_s()函数 等来操作方法c_str()返回的指针
    OpenGL 入门指南(配置GLFW ,着色语言高亮,以及一些常见问题)
    汽车加工厂
  • 原文地址:https://www.cnblogs.com/wangjinming/p/3778002.html
Copyright © 2011-2022 走看看