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;
            }
  • 相关阅读:
    常规渗透:没遇到过的anquan狗
    SQLi-db 批量注入工具+教程
    国外整理的一套在线渗透测试资源合集
    重大漏洞!PHP multipart/form-data头部解析远程拒绝服务漏洞
    MS15-051 修正版Exploit(Webshell可用)
    网站渗透常用到的Python小脚本
    项目<<魔兽登录系统>>
    第七章:存储过程
    第六章:事务,视图和索引
    SQL高级查询:嵌套和分页
  • 原文地址:https://www.cnblogs.com/wangjinming/p/3778002.html
Copyright © 2011-2022 走看看