zoukankan      html  css  js  c++  java
  • uwp 中的动画

    xml

    ---------------------------------------

    <Page

        x:Class="MyApp.MainPage"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:local="using:MyApp"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        mc:Ignorable="d"

        Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

        <Grid>

            <Path HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" Height="300" Stretch="Uniform" Fill="Yellow" RenderTransformOrigin="0.5,0.5">

                <Path.Data>

                    <GeometryGroup>

                        <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="20"/>

                        <EllipseGeometry Center="50,50" RadiusX="20" RadiusY="50"/>

                    </GeometryGroup>

                </Path.Data>

                <Path.RenderTransform>

                    <RotateTransform x:Name="rttrf" Angle="0"/>

                </Path.RenderTransform>

            </Path>

        </Grid>

    </Page>

    C# code

    -------------------------------------------

      public sealed partial class MainPage : Page

        {

            Storyboard m_storyboard = null;

            public MainPage()

            {

                this.InitializeComponent();

                this.NavigationCacheMode = NavigationCacheMode.Required;

                // 初始化演示图板

                m_storyboard = new Storyboard();

                // 定义时间线

                DoubleAnimation da = new DoubleAnimation();

                da.Duration = TimeSpan.FromSeconds(2d); //时间线持续时间

                da.From = 0d; //初始值

                da.To = 360d; //最终值

                // 设置为无限循环播放

                da.RepeatBehavior = RepeatBehavior.Forever;

                // 将时间线与RotateTransform对象关联

                Storyboard.SetTarget(da, rttrf);

                Storyboard.SetTargetProperty(da, "Angle");

                // 将时间线加入Storyboard的时间线集合中

                m_storyboard.Children.Add(da);

            }

            protected override void OnNavigatedTo(NavigationEventArgs e)

            {

                // 开始播放动画

                m_storyboard.Begin();

            }

        }

  • 相关阅读:
    centos7下安装jdk
    在centos7关于防火墙的基本操作
    hadoop的特性
    java中怎么使用combobox,并获取其选中的值
    @suppressWarnings("unchecked")在java中的作用
    The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Invalid byte 2 of 2-byte UTF-8 sequence解决方案
    Nmap
    XSS-笔记
    sql盲注-笔记
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14222270.html
Copyright © 2011-2022 走看看