zoukankan      html  css  js  c++  java
  • uwp 动画Storyboard

    代码如下:

     <Page.Resources>
            <Storyboard x:Name="storyboard">
                <DoubleAnimation Storyboard.TargetName="rect"
                                 Storyboard.TargetProperty="(Canvas.Left)"
                                 By="300"
                                 Duration="0:0:2"
                                 AutoReverse="True"
                                 RepeatBehavior="Forever"></DoubleAnimation>         
            </Storyboard>
        </Page.Resources>

     <Canvas Background="Azure"
                    Width="600"
                    Height="400">
                <Rectangle x:Name="rect"
                           Fill="Red"
                           Width="100"
                           Height="50"></Rectangle>
                <Button Canvas.Top="50"
                        Width="100"
                        Height="50"
                        Content="go"
                        Click="Button_Click_1"></Button>       
            </Canvas>

    private void Button_Click_1(object sender, RoutedEventArgs e)
            {
                storyboard.Begin();
            }

    第一次接触到动画效果,感觉很神奇,通过Storyboard,DoubleAnimation修改项要变化的属性 ,同时设置位置和时间参数,即可达到效果。

  • 相关阅读:
    bzoj1711
    bzoj1458
    bzoj1433
    hdu2732
    bzoj1066
    hdu3549
    poj1698
    [ZJOI2007]时态同步
    SA 学习笔记
    [LUOGU]2016 Sam数
  • 原文地址:https://www.cnblogs.com/v-haoz/p/9640972.html
Copyright © 2011-2022 走看看