PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/VBSL3Animation/Easing.xaml

#
XAML | 61 lines | 44 code | 1 blank | 16 comment | 0 complexity | b2aba1d73cae37f714440ce76c232348 MD5 | raw file
  1. <!--/****************************** Module Header ******************************\
  2. * Module Name: Easing.xaml
  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. <UserControl x:Class="VBSL3Animation.Easing"
  17. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  18. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  19. xmlns:c="clr-namespace:VBSL3Animation"
  20. Width="400" Height="300">
  21. <UserControl.Resources>
  22. <BackEase x:Name="BackEase" Amplitude="1" EasingMode="EaseIn"></BackEase>
  23. <c:MyEase x:Name="MyEase"></c:MyEase>
  24. <Storyboard x:Name="MyAnimationStoryboard">
  25. <PointAnimation x:Name="MyAnimation"
  26. Duration="0:0:2"
  27. Storyboard.TargetProperty="Center"
  28. Storyboard.TargetName="MyAnimatedEllipseGeometry"
  29. EasingFunction="{StaticResource BackEase}"
  30. >
  31. </PointAnimation>
  32. </Storyboard>
  33. </UserControl.Resources>
  34. <Grid x:Name="LayoutRoot" Background="White">
  35. <Grid.RowDefinitions>
  36. <RowDefinition Height="2*"></RowDefinition>
  37. <RowDefinition Height="8*"></RowDefinition>
  38. </Grid.RowDefinitions>
  39. <StackPanel Grid.Row="0">
  40. <RadioButton GroupName="g1" Content="BackEase" IsChecked="true" x:Name="BackEaseRadioButton" Click="BackEaseRadioButton_Click"></RadioButton>
  41. <RadioButton GroupName="g1" Content="MyEase" IsChecked="false" x:Name="MyEaseRadioButton" Click="MyEaseRadioButton_Click"></RadioButton>
  42. <TextBlock Text="Please click mouse in the pink area."></TextBlock>
  43. </StackPanel>
  44. <StackPanel MouseLeftButtonDown="MyStackPanel_MouseLeftButtonDown" x:Name="MyStackPanel" Background="Pink" Grid.Row="1">
  45. <Path>
  46. <Path.Fill>
  47. <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
  48. <GradientStop Color="#FFF1F7FB" Offset="0"/>
  49. <GradientStop Color="#FF3794E4" Offset="1"/>
  50. </LinearGradientBrush>
  51. </Path.Fill>
  52. <Path.Data>
  53. <!-- Describes an ellipse. -->
  54. <EllipseGeometry x:Name="MyAnimatedEllipseGeometry"
  55. Center="50,50" RadiusX="15" RadiusY="15" />
  56. </Path.Data>
  57. </Path>
  58. </StackPanel>
  59. </Grid>
  60. </UserControl>