PageRenderTime 48ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/VBSL3Animation/ReadMe.txt

#
Plain Text | 85 lines | 58 code | 27 blank | 0 comment | 0 complexity | 0fe90caaa52d3a12697c48afaa12bb33 MD5 | raw file
  1. ========================================================================
  2. SILVERLIGHT APPLICATION : VBSL3Animation Project Overview
  3. ========================================================================
  4. /////////////////////////////////////////////////////////////////////////////
  5. Use:
  6. This example illustrates how to play animation in Silverlight. Since animation
  7. is a big topic, we only covers PointAnimation in this sample. For other animation
  8. classes, the code should be similar.
  9. /////////////////////////////////////////////////////////////////////////////
  10. Prerequisites:
  11. Silverlight 3 Tools for Visual Studio 2008 SP1
  12. http://www.microsoft.com/downloads/details.aspx?familyid=9442b0f2-7465-417a-88f3-5e7b5409e9dd&displaylang=en
  13. Silverilght 3 runtime:
  14. http://silverlight.net/getstarted/
  15. /////////////////////////////////////////////////////////////////////////////
  16. Code Logic:
  17. 1. MainPage.xaml:
  18. It is the container of the following UserControls:
  19. BasicPointAnimation.xaml
  20. AnimateDependencyProperty.xaml
  21. Easing.xaml
  22. CodeBehindCreation.xaml
  23. UsingKeyFrames.xaml
  24. 2. BasicPointAnimation.xaml:
  25. It shows how to write baisc PointAnimation for an EllipseGeometry. In the
  26. MouseLeftButtonDown event of MyStackPanel, current mouse position is got and the
  27. To property of PointAnimation object is updated. After that, call Begin() method
  28. of the StoryBoard object to play animation.
  29. 3. MyEllipse.xaml:
  30. This UserControl is used to wrap a EllipseGeometry. EllipseGeometry doesn't
  31. expose any event for its Center change. So to get a notification after Center
  32. change EllipseCenterProperty is added. A callback method is hooked so that whenever
  33. the EllipseCenterProperty is changed we can synchronize the changed value with the
  34. Center property of EllipseGeometry object, in which way to update UI.
  35. 4. AnimateDependencyProperty.xaml
  36. This UserControl uses MyEllipse UserControl. The TargetProperty of the StoryBoard
  37. in it is the EllipseCenterProperty of MyEllipse object. During the animation, the
  38. EllipseCenterProperty will be changed and the callback method MyHandler() will be
  39. called, which in turn calls OnEllipseCenterChanged() method to trigger the
  40. EllipseCenterChanged event. The EllipseCenterChanged event is public so we can hook
  41. event handler in AnimateDependencyProperty UserControl to get a notification for
  42. EllipseCenterProperty's change. In this sample, a Line object is updated in this
  43. event handler to simulate an animation effect.
  44. 5. Easing.xaml
  45. This UserControl demonstrates how to use built-in Ease classes and how to write a
  46. custom Ease class. By inheriting EasingFunctionBase and override its EaseInCore()
  47. method we can write our own Ease class.
  48. 6. CodeBehindCreation.xaml
  49. This UserControl shows how to initialize a Storyboard in code behind. The final effect
  50. is the same as BasicPointAnimation.xaml, which uses XAML to add Storyboard.
  51. 7. UsingKeyFrames.xaml
  52. This UserControl shows how to create KeyFrames based animation in Silverlight.
  53. In the sample SplineDoubleKeyFrame is used to specify each KeyFrame.
  54. /////////////////////////////////////////////////////////////////////////////
  55. References:
  56. Animation
  57. http://msdn.microsoft.com/en-us/library/cc189090(VS.95).aspx
  58. /////////////////////////////////////////////////////////////////////////////