對于Silverlight大家并不陌生,但是對于如何在Silverlight3中實(shí)現(xiàn)按路徑運(yùn)動,還是值得大家注意的。希望看過本文對大家有所幫助。
這幾天需要給終端機(jī)做個(gè)一組Logo沿圓形軌跡轉(zhuǎn)動效果, 直接用Winform實(shí)現(xiàn)太卡(通過不斷繪圖方式), 考慮到SL3可以脫機(jī)運(yùn)行, 就用它來實(shí)現(xiàn).
網(wǎng)上也找了很多教程, 發(fā)現(xiàn)沒有較好的方法, ***自己"研究"出一種可行的方法, 供大家討論:
1.運(yùn)行效果:

- Code  
 - <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>                                  <EllipseGeometry x:Name="MyAnimatedEllipseGeometry"              Center="300,300" RadiusX="15" RadiusY="15" />             </Path.Data>         </Path>     </Grid> </Window> 
相信大家都能看得懂代碼的意思, 這里由于時(shí)間原因(馬上要下班走人了)我就不多啰嗦了, 大家有什么好的方案也歡迎一同討論.
原文標(biāo)題:Silverlight3實(shí)現(xiàn)按路徑運(yùn)動[原創(chuàng)] 
鏈接:http://www.cnblogs.com/yimi329/archive/2009/11/17/1604822.html