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