zoukankan      html  css  js  c++  java
  • wp7 动画

    <Rectangle Width="100" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="Red" Name="darkMoon"/>           

        DoubleAnimationUsingKeyFrames doublea = new DoubleAnimationUsingKeyFrames()
                {
                    BeginTime = new TimeSpan(0, 0, 0, 2),
                    SpeedRatio=1,
                    Duration = new Duration(TimeSpan.FromSeconds(1)),
                    AutoReverse = false,
                    RepeatBehavior = new RepeatBehavior(20),
                    FillBehavior = FillBehavior.HoldEnd
                };
                EasingDoubleKeyFrame key1 = new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)),
                    Value = 0
                };
                EasingDoubleKeyFrame key2 = new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1)),
                    Value = 100
                };
                EasingDoubleKeyFrame key3 = new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(2)),
                    Value = 200
                };
                EasingDoubleKeyFrame key4 = new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3)),
                    Value = 300
                };
                doublea.KeyFrames.Add(key1);
                doublea.KeyFrames.Add(key2);
                doublea.KeyFrames.Add(key3);
                doublea.KeyFrames.Add(key4);

                Storyboard storyboard2 = new Storyboard();
                Storyboard.SetTarget(doublea, darkMoon);
                Storyboard.SetTargetProperty(doublea, new PropertyPath(WidthProperty));
                storyboard2.Children.Add(doublea);
                storyboard2.Begin();

    ////////////////////////////////////////////////////////////////////////////////////////////////////////

                DoubleAnimation doublea = new DoubleAnimation()
                {
                    BeginTime = new TimeSpan(0, 0, 0, 2),
                    From = 200,
                    To = 300,
                    Duration = new Duration(TimeSpan.FromSeconds(1)),
                    AutoReverse = false,
                    RepeatBehavior = new RepeatBehavior(20),
                    FillBehavior = FillBehavior.HoldEnd
                };
                Storyboard storyboard2 = new Storyboard();
                Storyboard.SetTarget(doublea, darkMoon);
                Storyboard.SetTargetProperty(doublea, new PropertyPath(WidthProperty));
                storyboard2.Children.Add(doublea);
                storyboard2.Begin();

  • 相关阅读:
    每日英语:China's Wistful Wen Gets His Wish
    每日英语:Singles Day in China
    每日英语:A Chinese Soccer Club Has Won Something!
    每日英语:Are Smartphones Turning Us Into Bad Samaritans?
    每日英语:The Benefits of a Sleep Buddy
    每日英语:Pediatricians Set Limits on Screen Time
    每日英语:The Risks of Big Data for Companies
    每日英语:Patent Wars Erupt Again in Tech Sector
    每日英语:Got a Case of the Mondays? Blame the Sunday Blues
    从构建分布式秒杀系统聊聊Lock锁使用中的坑
  • 原文地址:https://www.cnblogs.com/androllen/p/2861742.html
Copyright © 2011-2022 走看看