详解Silverlight3中实现按路径运动

开发 后端
在这里我们将讨论的是Silverlight3中实现按路径运动,希望对大家有所帮助。

对于Silverlight大家并不陌生,但是对于如何在Silverlight3中实现按路径运动,还是值得大家注意的。希望看过本文对大家有所帮助。

这几天需要给终端机做个一组Logo沿圆形轨迹转动效果, 直接用Winform实现太卡(通过不断绘图方式), 考虑到SL3可以脱机运行, 就用它来实现.

网上也找了很多教程, 发现没有较好的方法, ***自己"研究"出一种可行的方法, 供大家讨论:

1.运行效果:

运行效果

  1. Code  
  2. <Window x:Class="SLTest.test" 
  3.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  4.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  5.     Title="test" Height="600" Width="800"> 
  6.     <Window.Resources> 
  7.         <Storyboard x:Key="Storyboard1"> 
  8.             <PointAnimationUsingPath Storyboard.TargetName="MyAnimatedEllipseGeometry" Storyboard.TargetProperty="Center" Duration="0:0:5" RepeatBehavior="Forever"> 
  9.                 <PointAnimationUsingPath.PathGeometry> 
  10.                     <PathGeometry Figures="M 299.9 300 A 100,100 360 1 1 300.1,300 Z"/> 
  11.                 </PointAnimationUsingPath.PathGeometry> 
  12.             </PointAnimationUsingPath> 
  13.         </Storyboard> 
  14.     </Window.Resources> 
  15.     <Window.Triggers> 
  16.         <EventTrigger RoutedEvent="FrameworkElement.Loaded"> 
  17.             <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/> 
  18.         </EventTrigger> 
  19.     </Window.Triggers> 
  20.     <Grid> 
  21.         <Path x:Name="pt" Stroke="Black" Fill="Gray" Data="M 299.9 300 A 100,100 360 1 1 300.1,300 Z" /> 
  22.         <Path Fill="Blue"> 
  23.             <Path.Data> 
  24.                 <!-- Describes an ellipse. --> 
  25.                 <EllipseGeometry x:Name="MyAnimatedEllipseGeometry" 
  26.              Center="300,300" RadiusX="15" RadiusY="15" /> 
  27.             </Path.Data> 
  28.         </Path> 
  29.     </Grid> 
  30. </Window> 

相信大家都能看得懂代码的意思, 这里由于时间原因(马上要下班走人了)我就不多啰嗦了, 大家有什么好的方案也欢迎一同讨论.

原文标题:Silverlight3实现按路径运动[原创]

链接:http://www.cnblogs.com/yimi329/archive/2009/11/17/1604822.html

责任编辑:彭凡 来源: 博客园
相关推荐

2009-12-31 15:01:07

Silverlight

2009-04-23 10:08:03

Silverlight兼容开发

2009-08-12 10:47:38

Silverlight

2009-07-14 13:28:56

SketchFlow原型设计工具Expression

2009-07-24 18:03:44

2009-03-19 15:52:50

Silverlight位图WPF

2009-02-20 08:54:20

DownloaderSilverlight对象

2009-07-08 09:28:26

Silverlight

2009-07-14 11:03:07

Expression SketchFlowSilverlight

2010-01-04 13:09:51

Silverlight

2009-07-24 13:37:29

SilverlightSilverlight

2010-01-04 10:17:16

Silverlight

2009-07-14 15:34:17

Silverlight

2009-03-16 10:00:01

文件同步LivemeshSilverlight

2010-04-23 13:23:42

Silverlight

2009-07-11 23:32:51

2009-05-31 09:01:46

Silverlight3DExpression

2009-02-02 10:53:34

SilverlightSilverlightRIA

2009-06-25 11:18:20

Silverlight

2009-07-10 11:45:52

HTML 5
点赞
收藏

51CTO技术栈公众号