PageRenderTime 29ms CodeModel.GetById 18ms app.highlight 7ms RepoModel.GetById 1ms 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
17Partial Public Class Easing
18    Inherits UserControl
19
20    Public Sub New()
21        InitializeComponent()
22    End Sub
23    ''' <summary>
24    ''' Tbe following event handler change the To property of PointAnimation object,
25    ''' then begin the Storyboard to play the animation. Please note we can change
26    ''' To property even when the animation is playing.
27    ''' </summary>
28    ''' <param name="sender"></param>
29    ''' <param name="e"></param>
30    Private Sub MyStackPanel_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
31        Dim targetpoint = e.GetPosition(Me.MyStackPanel)
32        Me.MyAnimation.To = targetpoint
33        Me.MyAnimationStoryboard.Begin()
34    End Sub
35
36    Private Sub MyEaseRadioButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
37        Me.MyAnimation.EasingFunction = TryCast(Me.Resources("MyEase"), IEasingFunction)
38    End Sub
39
40    Private Sub BackEaseRadioButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
41        Me.MyAnimation.EasingFunction = TryCast(Me.Resources("BackEase"), IEasingFunction)
42    End Sub
43
44End Class
45
46''' <summary>
47''' A custom Ease class 
48''' </summary>
49Public Class MyEase
50    Inherits EasingFunctionBase
51    Protected Overrides Function EaseInCore(ByVal normalizedTime As Double) As Double
52        Return normalizedTime / 5
53    End Function
54
55End Class