zoukankan      html  css  js  c++  java
  • wp8 入门到精通 动画

    http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm#/?sref=transforms_ovw_animating_transforms

    public Storyboard HideStoryBoard()
    {
    Storyboard storyboard = new Storyboard();
    double num = 0.2;
    DoubleAnimation animation = new DoubleAnimation();
    Storyboard.SetTarget(animation, sp);
    animation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)"));
    animation.To = 480;
    animation.From = ((CompositeTransform)sp.RenderTransform).TranslateX;
    animation.Duration = new Duration(TimeSpan.FromSeconds(num));
    
    PowerEase ease = new PowerEase();
    ease.EasingMode = EasingMode.EaseInOut;
    ease.Power = 2.0;
    animation.EasingFunction = ease;
    
    
    DoubleAnimation animationOpacity = new DoubleAnimation();
    Storyboard.SetTarget(animationOpacity, sp);
    animationOpacity.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("UIElement.Opacity"));
    animationOpacity.To = 0;
    animationOpacity.From = 1;
    animationOpacity.Duration = new Duration(TimeSpan.FromSeconds(num));
    
    animationOpacity.SetValue(Storyboard.TargetNameProperty, "sp");
    animationOpacity.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("UIElement.Opacity"));
    
    Storyboard.SetTargetName(animationOpacity, sp.Name);
    Storyboard.SetTargetProperty(animationOpacity, new PropertyPath(StackPanel.OpacityProperty));
    
    storyboard.Children.Add(animation);
    storyboard.Children.Add(animationOpacity);
    return storyboard;
    }
                <Button x:Name="myStackPanel">
                    <Button.Triggers>
                        <EventTrigger>
                            <BeginStoryboard>
                                <Storyboard>
                                    <ColorAnimation BeginTime="00:00:00" From="Red" To="Transparent" Duration="0:0:3"
                                                    Storyboard.TargetName="mySolidColorBrush" 
                                            Storyboard.TargetProperty="Color">
                                    </ColorAnimation>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Button.Triggers>
                    <Button.Background>
                        <SolidColorBrush x:Name="mySolidColorBrush" Color="Red" />
                    </Button.Background>
                </Button>
  • 相关阅读:
    (转)const变量通过指针修改问题
    sleep wait yeild join
    做事贵在坚持
    我的学习进度
    织梦dedecms后台添加图片style全部都变成st<x>yle的解决办法
    调用DEDE日期时间格式整理大全
    Arcgis andoid开发之应用百度地图接口实现精准定位与显示
    jquery自定义插件——window的实现
    lzugis—搭建属于自己的小型的版本控制SVN
    lzugis——Arcgis Server for JavaScript API之自定义InfoWindow
  • 原文地址:https://www.cnblogs.com/luquanmingren/p/3622509.html
Copyright © 2011-2022 走看看