下面使用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
源代码下载
精彩图集