龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > asp.net编程 >

Silverlight3编程之实现动画按路径运动

时间:2009-12-21 11:47来源:未知 作者:admin 点击:
分享到:
下面使用Silverlight3编程给端机做个一组Logo沿圆形轨迹转动效果. 1.运行效果: Code [http://www.xueit.com] Window x:Class = " SLTest.test " xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation " xmlns:x =

下面使用Silverlight3编程给端机做个一组Logo沿圆形轨迹转动效果.

1.运行效果:

 

Code [http://www.xueit.com]
<Window x:Class="SLTest.test"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="test" Height="600" Width="800">
    <Window.Resources>
        <Storyboard x:Key="Storyboard1">
            <PointAnimationUsingPath Storyboard.TargetName="MyAnimatedEllipseGeometry" Storyboard.TargetProperty="Center" Duration="0:0:5" RepeatBehavior="Forever">
                <PointAnimationUsingPath.PathGeometry>
                    <PathGeometry Figures="M 299.9 300 A 100,100 360 1 1 300.1,300 Z"/>
                </PointAnimationUsingPath.PathGeometry>
            </PointAnimationUsingPath>
        </Storyboard>
    </Window.Resources>
    <Window.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
        </EventTrigger>
    </Window.Triggers>
    <Grid>
        <Path x:Name="pt" Stroke="Black" Fill="Gray" Data="M 299.9 300 A 100,100 360 1 1 300.1,300 Z" />
        <Path Fill="Blue">
            <Path.Data>
                <!-- Describes an ellipse. -->
                <EllipseGeometry x:Name="MyAnimatedEllipseGeometry"
             Center="300,300" RadiusX="15" RadiusY="15" />
            </Path.Data>
        </Path>
    </Grid>
</Window>

     程序运行环境: VS2008SP1

     源代码下载

精彩图集

赞助商链接