PageRenderTime 60ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/VBSL3Animation/Easing.xaml.vb

#
Visual Basic | 55 lines | 23 code | 7 blank | 25 comment | 0 complexity | 67b7c613a034364b86c793e87fda5bfd MD5 | raw file
  1. '***************************** Module Header ******************************\
  2. '* Module Name: Easing.xaml.vb
  3. '* Project: VBSL3Animation
  4. '* Copyright (c) Microsoft Corporation.
  5. '*
  6. '* This module shows how to use EasingFunction for PointAnimation. In addition,
  7. '* it demonstrates how to write a custom Ease class.
  8. '*
  9. '* This source is subject to the Microsoft Public License.
  10. '* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
  11. '* All other rights reserved.
  12. '*
  13. '* History:
  14. '* * 9/9/2009 05:00 PM Allen Chen Created
  15. '\**************************************************************************
  16. Partial Public Class Easing
  17. Inherits UserControl
  18. Public Sub New()
  19. InitializeComponent()
  20. End Sub
  21. ''' <summary>
  22. ''' Tbe following event handler change the To property of PointAnimation object,
  23. ''' then begin the Storyboard to play the animation. Please note we can change
  24. ''' To property even when the animation is playing.
  25. ''' </summary>
  26. ''' <param name="sender"></param>
  27. ''' <param name="e"></param>
  28. Private Sub MyStackPanel_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
  29. Dim targetpoint = e.GetPosition(Me.MyStackPanel)
  30. Me.MyAnimation.To = targetpoint
  31. Me.MyAnimationStoryboard.Begin()
  32. End Sub
  33. Private Sub MyEaseRadioButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
  34. Me.MyAnimation.EasingFunction = TryCast(Me.Resources("MyEase"), IEasingFunction)
  35. End Sub
  36. Private Sub BackEaseRadioButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
  37. Me.MyAnimation.EasingFunction = TryCast(Me.Resources("BackEase"), IEasingFunction)
  38. End Sub
  39. End Class
  40. ''' <summary>
  41. ''' A custom Ease class
  42. ''' </summary>
  43. Public Class MyEase
  44. Inherits EasingFunctionBase
  45. Protected Overrides Function EaseInCore(ByVal normalizedTime As Double) As Double
  46. Return normalizedTime / 5
  47. End Function
  48. End Class