■ EasingDoubleKeyFrame 엘리먼트를 사용하는 방법을 보여준다.
▶ 예제 코드 (XAML)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<Canvas x:Name="canvas"> <Canvas.Resources> <Storyboard x:Name="storyboard"> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="rectangle" Storyboard.TargetProperty="Width"> <EasingDoubleKeyFrame KeyTime="00:00:01" Value="200"> <EasingDoubleKeyFrame.EasingFunction> <SineEase /> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> <EasingDoubleKeyFrame KeyTime="00:00:05" Value="300"> <EasingDoubleKeyFrame.EasingFunction> <ElasticEase /> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> </Storyboard> </Canvas.Resources> <Rectangle x:Name="rectangle" Canvas.Left="0" Canvas.Top="0" Width="100" Height="100"> <Rectangle.Fill> <SolidColorBrush Color="Red" /> </Rectangle.Fill> </Rectangle> </Canvas> |
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
using System.Windows.Input; ... this.rectangle.MouseLeftButtonDown += rectangle_MouseLeftButtonDown; ... #region 사각형 마우스 왼쪽 버튼 다운시 처리하기 - rectangle_MouseLeftButtonDown(sender, e) /// <summary> /// 사각형 마우스 왼쪽 버튼 다운시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void rectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.storyboard.Begin(); } #endregion |