• 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();

            }

        }

  • 相关阅读:
    IIS下配置跨域设置Access-Control-Allow-Origin
    Arcgis去除Z,M值
    GIS开发之数据查询
    GIS开发之计算四参数,七参数
    Openlayer3之绚丽的界面框架-Materialize
    Openlayer3之C++接口在javaScript的封装使用
    Windows环境和Linux环境下Redis主从复制配置
    Centos 7 安装和配置Redis
    .net手动编写Windows服务
    SQL获取当前日期的年、月、日、时、分、秒数据
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14222270.html
Copyright © 2020-2023  润新知