키프레임 (KeyFrame) - SplineColorKeyFrame (속도가변곡선, 보간법, 비선형)
.NET프로그래밍/Silverlight 3.0 2009. 12. 4. 11:30 |[MainPage.xaml]
<UserControl x:Class="RiaSplineColorKeyFrame.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Canvas x:Name="LayoutRoot" Background="White">
<Canvas.Resources>
<Storyboard x:Name="sb">
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="rect" AutoReverse="True" RepeatBehavior="Forever"
Storyboard.TargetProperty="(Canvas.Top)"
Duration="00:00:10">
<DoubleAnimationUsingKeyFrames.KeyFrames>
<!-- 위쪽에서 당기는 타원 : 빨리가다가 천천히 -->
<SplineDoubleKeyFrame KeyTime="0:0:5" Value="210" KeySpline="0.0,1.0,1.0,1.0"></SplineDoubleKeyFrame>
<!-- 아래쪽에서 당기는 타원 : 천천히가다가 빨리 -->
<SplineDoubleKeyFrame KeyTime="0:0:10" Value="420" KeySpline="1.0,0.0,1.0,1.0"></SplineDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames.KeyFrames>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Canvas.Resources>
<Rectangle x:Name="rect" Width="50" Height="50" Canvas.Left="10" Canvas.Top="10" Fill="Red" />
</Canvas>
</UserControl>
[MainPage.xaml.cs]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace RiaSplineColorKeyFrame
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
sb.Begin();
}
}
}
'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글
VisualStateManager 클래스 (0) | 2009.12.07 |
---|---|
키프레임 (KeyFrame) - EasingDoubleKeyFrame (여러가지 모양을 단어화(함수화)) (0) | 2009.12.04 |
키프레임 (KeyFrame) - DiscreteColorKeyFrame (끊어지는 움직임) (0) | 2009.12.04 |
키프레임 (KeyFrame) - LinearDoubleKeyFrame (연속적인 움직임, 선형) (0) | 2009.12.04 |
키프레임 (KeyFrame) - DoubleAnimationUsingKeyFrames (0) | 2009.12.04 |