DiscreteInt16KeyFrame 클래스

정의

불연속 보간을 사용하여 이전 키 프레임의 Int16 값에서 고유 Value로 애니메이션 효과를 적용합니다.

public ref class DiscreteInt16KeyFrame : System::Windows::Media::Animation::Int16KeyFrame
public class DiscreteInt16KeyFrame : System.Windows.Media.Animation.Int16KeyFrame
type DiscreteInt16KeyFrame = class
    inherit Int16KeyFrame
Public Class DiscreteInt16KeyFrame
Inherits Int16KeyFrame
상속

예제

애니메이션의 보간은 애니메이션이 지속 기간 동안 값 사이에서 전환되는 방식을 설명합니다. 애니메이션에서 사용하는 키 프레임 형식을 선택하여 해당 키 프레임 세그먼트에 대한 보간 방법을 정의할 수 있습니다. 보간 방법 종류에는 선형, 불연속 및 스플라인의 세 가지가 있습니다. 이 예제에서는 DoubleAnimationUsingKeyFrames 이러한 보간 형식을 보여 줍니다.

다음 예제에서는 다른 보간 방법을 사용할 수 있는 각 합니다 DoubleAnimationUsingKeyFrames 클래스의 위치에 애니메이션 효과를 Rectangle입니다.

  1. 처음 3 초 동안의 인스턴스를 사용 하 여는 LinearDoubleKeyFrame 500 위치 시작 위치부터 일정 한 속도로 경로 따라 사각형을 이동 하는 클래스입니다. 과 같은 선형 키 프레임 LinearDoubleKeyFrame 값 사이 매끄러운 선형 전환을 만듭니다.

  2. 4 초가 끝나면의 인스턴스를 사용 하는 DiscreteDoubleKeyFrame 갑자기 다음 위치로 사각형을 이동 하는 클래스입니다. 과 같은 불연속 키 프레임 DiscreteDoubleKeyFrame 값 간에 갑작스러운 이동을 만듭니다. 이 예제에서 사각형은 시작 위치에 있다가 갑자기 500 위치에 나타납니다.

  3. 마지막 2 초의 인스턴스를 사용 하는 SplineDoubleKeyFrame 클래스 사각형을 다시 시작 위치로 이동 합니다. 과 같은 스플라인 키 프레임 SplineDoubleKeyFrame 의 값에 따라 값 사이 가변 전환을 만듭니다는 KeySpline 속성입니다. 이 예제에서는 사각형 느리게 이동 하 여 시작 하 고 시간 세그먼트의 끝에 다가가 면 기하급수적으로 빨라집니다.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.Windows.Media;

namespace Microsoft.Samples.KeyFrameExamples
{
    /// <summary>
    /// This example shows how to use the DoubleAnimationUsingKeyFrames class to
    /// animate the position of an object.
    /// Key frame animations enable you to create complex animations 
    /// by specifying multiple destination values
    /// and controlling the animation's interpolation method.
    /// </summary>
    public class AltDoubleAnimationUsingKeyFramesExample : Page
    {
        public AltDoubleAnimationUsingKeyFramesExample()
        {
            Title = "DoubleAnimationUsingKeyFrames Example";
            Background = Brushes.White;
            Margin = new Thickness(20);

            // Create a NameScope for this page so that
            // Storyboards can be used.
            NameScope.SetNameScope(this, new NameScope());

            // Create a rectangle.
            Rectangle aRectangle = new Rectangle();
            aRectangle.Width = 100;
            aRectangle.Height = 100;
            aRectangle.Stroke = Brushes.Black;
            aRectangle.StrokeThickness = 5;

            // Create a Canvas to contain and
            // position the rectangle.
            Canvas containerCanvas = new Canvas();
            containerCanvas.Width = 610;
            containerCanvas.Height = 300;
            containerCanvas.Children.Add(aRectangle);
            Canvas.SetTop(aRectangle, 100);
            Canvas.SetLeft(aRectangle, 10);         

            // Create a TranslateTransform to 
            // move the rectangle.
            TranslateTransform animatedTranslateTransform = 
                new TranslateTransform();
            aRectangle.RenderTransform = animatedTranslateTransform;  

            // Assign the TranslateTransform a name so that
            // it can be targeted by a Storyboard.
            this.RegisterName(
                "AnimatedTranslateTransform", animatedTranslateTransform);

            // Create a DoubleAnimationUsingKeyFrames to
            // animate the TranslateTransform.
            DoubleAnimationUsingKeyFrames translationAnimation 
                = new DoubleAnimationUsingKeyFrames();
            translationAnimation.Duration = TimeSpan.FromSeconds(6);

            // Animate from the starting position to 500
            // over the first second using linear
            // interpolation.
            translationAnimation.KeyFrames.Add(
                new LinearDoubleKeyFrame(
                    500, // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3))) // KeyTime
                );

            // Animate from 500 (the value of the previous key frame) 
            // to 400 at 4 seconds using discrete interpolation.
            // Because the interpolation is discrete, the rectangle will appear
            // to "jump" from 500 to 400.
            translationAnimation.KeyFrames.Add(
                new DiscreteDoubleKeyFrame(
                    400, // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(4))) // KeyTime
                );

            // Animate from 400 (the value of the previous key frame) to 0
            // over two seconds, starting at 4 seconds (the key time of the
            // last key frame) and ending at 6 seconds.
            translationAnimation.KeyFrames.Add(
                new SplineDoubleKeyFrame(
                    0, // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(6)), // KeyTime
                    new KeySpline(0.6,0.0,0.9,0.0) // KeySpline
                    )
                );

            // Set the animation to repeat forever. 
            translationAnimation.RepeatBehavior = RepeatBehavior.Forever;

            // Set the animation to target the X property
            // of the object named "AnimatedTranslateTransform."
            Storyboard.SetTargetName(translationAnimation, "AnimatedTranslateTransform");
            Storyboard.SetTargetProperty(
                translationAnimation, new PropertyPath(TranslateTransform.XProperty));

            // Create a storyboard to apply the animation.
            Storyboard translationStoryboard = new Storyboard();
            translationStoryboard.Children.Add(translationAnimation);

            // Start the storyboard after the rectangle loads.
            aRectangle.Loaded += delegate(object sender, RoutedEventArgs e)
            {
                translationStoryboard.Begin(this);
            };

            Content = containerCanvas;
        }
    }
}

Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Shapes
Imports System.Windows.Media.Animation
Imports System.Windows.Media

Namespace Microsoft.Samples.KeyFrameExamples
    ''' <summary>
    ''' This example shows how to use the DoubleAnimationUsingKeyFrames class to
    ''' animate the position of an object.
    ''' Key frame animations enable you to create complex animations 
    ''' by specifying multiple destination values
    ''' and controlling the animation's interpolation method.
    ''' </summary>
    Public Class AltDoubleAnimationUsingKeyFramesExample
        Inherits Page
        Public Sub New()
            Title = "DoubleAnimationUsingKeyFrames Example"
            Background = Brushes.White
            Margin = New Thickness(20)

            ' Create a NameScope for this page so that
            ' Storyboards can be used.
            NameScope.SetNameScope(Me, New NameScope())

            ' Create a rectangle.
            Dim aRectangle As New Rectangle()
            aRectangle.Width = 100
            aRectangle.Height = 100
            aRectangle.Stroke = Brushes.Black
            aRectangle.StrokeThickness = 5

            ' Create a Canvas to contain and
            ' position the rectangle.
            Dim containerCanvas As New Canvas()
            containerCanvas.Width = 610
            containerCanvas.Height = 300
            containerCanvas.Children.Add(aRectangle)
            Canvas.SetTop(aRectangle, 100)
            Canvas.SetLeft(aRectangle, 10)

            ' Create a TranslateTransform to 
            ' move the rectangle.
            Dim animatedTranslateTransform As New TranslateTransform()
            aRectangle.RenderTransform = animatedTranslateTransform

            ' Assign the TranslateTransform a name so that
            ' it can be targeted by a Storyboard.
            Me.RegisterName("AnimatedTranslateTransform", animatedTranslateTransform)

            ' Create a DoubleAnimationUsingKeyFrames to
            ' animate the TranslateTransform.
            Dim translationAnimation As New DoubleAnimationUsingKeyFrames()
            translationAnimation.Duration = TimeSpan.FromSeconds(6)

            ' Animate from the starting position to 500
            ' over the first second using linear
            ' interpolation.
            translationAnimation.KeyFrames.Add(New LinearDoubleKeyFrame(500, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3)))) ' KeyTime -  Target value (KeyValue)

            ' Animate from 500 (the value of the previous key frame) 
            ' to 400 at 4 seconds using discrete interpolation.
            ' Because the interpolation is discrete, the rectangle will appear
            ' to "jump" from 500 to 400.
            translationAnimation.KeyFrames.Add(New DiscreteDoubleKeyFrame(400, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(4)))) ' KeyTime -  Target value (KeyValue)

            ' Animate from 400 (the value of the previous key frame) to 0
            ' over two seconds, starting at 4 seconds (the key time of the
            ' last key frame) and ending at 6 seconds.
            translationAnimation.KeyFrames.Add(New SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(6)), New KeySpline(0.6,0.0,0.9,0.0))) ' KeySpline -  KeyTime -  Target value (KeyValue)

            ' Set the animation to repeat forever. 
            translationAnimation.RepeatBehavior = RepeatBehavior.Forever

            ' Set the animation to target the X property
            ' of the object named "AnimatedTranslateTransform."
            Storyboard.SetTargetName(translationAnimation, "AnimatedTranslateTransform")
            Storyboard.SetTargetProperty(translationAnimation, New PropertyPath(TranslateTransform.XProperty))

            ' Create a storyboard to apply the animation.
            Dim translationStoryboard As New Storyboard()
            translationStoryboard.Children.Add(translationAnimation)

            ' Start the storyboard after the rectangle loads.
            AddHandler aRectangle.Loaded, Sub(sender As Object, e As RoutedEventArgs) translationStoryboard.Begin(Me)

            Content = containerCanvas
        End Sub

    End Class
End Namespace
<!-- This example shows how to use the DoubleAnimationUsingKeyFrames to 
     animate the position of an object. 
     Key frame animations enable you to create complex animations 
     by specifying multiple destination values
     and controlling the animation's interpolation method.
-->
<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="DoubleAnimationUsingKeyFrames Example"
  Background="White" Margin="20">       
  <Canvas Width="610" Height="300">
  
    <!-- The position of this rectangle is animated using 
         a key frame animation. -->
    <Rectangle 
      Canvas.Top="100"
      Canvas.Left="10"
      Height="100"
      Width="100"
      Stroke="Black"
      StrokeThickness="5">
      <Rectangle.RenderTransform>
        <TranslateTransform x:Name="AnimatedTranslateTransform" />
      </Rectangle.RenderTransform>
      
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.Loaded">
          <BeginStoryboard>
            <Storyboard>

              <!-- Animate the TranslateTransform.X property using 3 KeyFrames
                   which animates the rectangle along a straight line. 
                   This animation repeats indefinitely. -->
              <DoubleAnimationUsingKeyFrames
                Storyboard.TargetName="AnimatedTranslateTransform"
                Storyboard.TargetProperty="X"
                Duration="0:0:6"
                RepeatBehavior="Forever">

                <!-- Using a LinearDoubleKeyFrame, the rectangle moves 
                     steadily from its starting position to 500 over 
                     the first 3 seconds.  -->
                <LinearDoubleKeyFrame Value="500" KeyTime="0:0:3" />

                <!-- Using a DiscreteDoubleKeyFrame, the rectangle suddenly 
                     appears at 400 after the fourth second of the animation. -->
                <DiscreteDoubleKeyFrame Value="400" KeyTime="0:0:4" />

                <!-- Using a SplineDoubleKeyFrame, the rectangle moves 
                     back to its starting point. The
                     animation starts out slowly at first and then speeds up. 
                     This KeyFrame ends after the 6th
                     second. -->
                <SplineDoubleKeyFrame KeySpline="0.6,0.0 0.9,0.00" Value="0" KeyTime="0:0:6" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>
  </Canvas>
</Page>

모든 <Type>AnimationUsingKeyFrames 클래스가 모든 보간 메서드를 지원하는 것은 아닙니다. 자세한 내용은 키 프레임 애니메이션 개요를 참조하세요.

설명

이 클래스의 일부로 사용 됩니다는 Int16KeyFrameCollection 와 함께에서 Int16AnimationUsingKeyFrames 애니메이션 효과를 주는 Int16 키 프레임의 집합을 따라 속성 값입니다.

키 프레임의 세그먼트를 정의 합니다 Int16AnimationUsingKeyFrames 속해 있는 합니다. 각 키 프레임에는 대상이 ValueKeyTime합니다. 합니다 KeyTime 지정 시간을 키 프레임의 Value 도달 해야 합니다. 키 프레임 애니메이션을 적용 이전 키 프레임의 대상 값에서 고유한 대상 값입니다. 이전 키 프레임 종료 하 고 자체 키 시간에 도달 하면 종료 하는 경우 시작 합니다.

과 같은 불연속 키 프레임 DiscreteInt16KeyFrame "사이 갑작스러운" 값 (보간 없음)를 만듭니다. 즉, 속성 키 프레임의 키 시간이 시점 이동 갑자기 대상 값에 도달할 때까지 변경 되지 않습니다.

생성자

DiscreteInt16KeyFrame()

DiscreteInt16KeyFrame 클래스의 새 인스턴스를 초기화합니다.

DiscreteInt16KeyFrame(Int16)

지정된 끝 값을 사용하여 DiscreteInt16KeyFrame 클래스의 새 인스턴스를 초기화합니다.

DiscreteInt16KeyFrame(Int16, KeyTime)

지정한 끝 값 및 키 시간을 사용하여 DiscreteInt16KeyFrame 클래스의 새 인스턴스를 초기화합니다.

속성

CanFreeze

개체를 수정 불가능으로 설정할 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Freezable)
DependencyObjectType

DependencyObjectType 이 instance CLR 형식을 래핑하는 을 가져옵니다.

(다음에서 상속됨 DependencyObject)
Dispatcher

Dispatcher와 연결된 DispatcherObject를 가져옵니다.

(다음에서 상속됨 DispatcherObject)
IsFrozen

개체가 현재 수정 가능한지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Freezable)
IsSealed

이 인스턴스가 현재 봉인되어 있는지(읽기 전용인지) 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 DependencyObject)
KeyTime

키 프레임의 대상 Value 가 도달해야 하는 시간을 가져오거나 설정합니다.

(다음에서 상속됨 Int16KeyFrame)
Value

키 프레임의 대상 값을 가져오거나 설정합니다.

(다음에서 상속됨 Int16KeyFrame)

메서드

CheckAccess()

호출 스레드가 이 DispatcherObject에 액세스할 수 있는지 여부를 확인합니다.

(다음에서 상속됨 DispatcherObject)
ClearValue(DependencyProperty)

속성의 로컬 값을 지웁니다. 지울 속성이 DependencyProperty 식별자에서 지정됩니다.

(다음에서 상속됨 DependencyObject)
ClearValue(DependencyPropertyKey)

읽기 전용 속성의 로컬 값을 지웁니다. 선언할 속성이 DependencyPropertyKey에서 지정됩니다.

(다음에서 상속됨 DependencyObject)
Clone()

개체 값의 전체 복사본을 만들어 Freezable의 수정 가능한 복제본을 만듭니다. 개체의 종속성 속성을 복사하는 경우 이 메서드는 더 이상 확인되지 않을 수도 있는 식을 복사하지만 애니메이션 또는 해당 현재 값은 복사하지 않습니다.

(다음에서 상속됨 Freezable)
CloneCore(Freezable)

기본(애니메이션이 적용되지 않은) 속성 값을 사용하여 인스턴스를 지정된 Freezable의 복제본(전체 복사본)으로 만듭니다.

(다음에서 상속됨 Freezable)
CloneCurrentValue()

현재 값을 사용하여 Freezable의 수정 가능한 복제본(전체 복사본)을 만듭니다.

(다음에서 상속됨 Freezable)
CloneCurrentValueCore(Freezable)

현재 속성 값을 사용하여 이 인스턴스를 지정된 Freezable의 수정 가능한 클론(전체 복사본)으로 만듭니다.

(다음에서 상속됨 Freezable)
CoerceValue(DependencyProperty)

지정된 종속성 속성의 값을 강제 변환합니다. 호출하는 DependencyObject에 있으므로 이 작업은 종속성 속성의 속성 메타데이터에 지정된 CoerceValueCallback 함수를 호출하여 수행합니다.

(다음에서 상속됨 DependencyObject)
CreateInstance()

Freezable 클래스의 새 인스턴스를 초기화합니다.

(다음에서 상속됨 Freezable)
CreateInstanceCore()

DiscreteInt16KeyFrame의 새 인스턴스를 만듭니다.

Equals(Object)

제공된 DependencyObject가 현재 DependencyObject에 해당하는지 여부를 확인합니다.

(다음에서 상속됨 DependencyObject)
Freeze()

현재 개체를 수정할 수 없게 설정하고 해당 IsFrozen 속성을 true로 설정합니다.

(다음에서 상속됨 Freezable)
FreezeCore(Boolean)

Freezable을 수정할 수 없게 만들거나, 수정할 수 없게 만들 수 있는지 테스트합니다.

(다음에서 상속됨 Freezable)
GetAsFrozen()

애니메이션이 적용되지 않은 기준 속성 값을 사용하여 Freezable의 고정된 복사본을 만듭니다. 복사본이 고정되므로 고정된 하위 개체는 모두 참조를 통해 복사됩니다.

(다음에서 상속됨 Freezable)
GetAsFrozenCore(Freezable)

기본(애니메이션이 적용되지 않은) 속성 값을 사용하여 인스턴스를 지정된 Freezable의 고정된 복제본으로 만듭니다.

(다음에서 상속됨 Freezable)
GetCurrentValueAsFrozen()

현재 속성 값을 사용하여 Freezable의 고정된 복사본을 만듭니다. 복사본이 고정되므로 고정된 하위 개체는 모두 참조를 통해 복사됩니다.

(다음에서 상속됨 Freezable)
GetCurrentValueAsFrozenCore(Freezable)

현재 인스턴스를 지정된 Freezable의 고정 클론으로 만듭니다. 개체에 애니메이션 효과를 준 종속성 속성이 있는 경우 애니메이션 효과를 준 현재 값이 복사됩니다.

(다음에서 상속됨 Freezable)
GetHashCode()

DependencyObject의 해시 코드를 가져옵니다.

(다음에서 상속됨 DependencyObject)
GetLocalValueEnumerator()

DependencyObject에 대해 로컬로 값을 설정한 종속성 속성을 확인하기 위한 특수 열거자를 만듭니다.

(다음에서 상속됨 DependencyObject)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
GetValue(DependencyProperty)

DependencyObject의 인스턴스에서 종속성 속성의 현재 유효 값을 반환합니다.

(다음에서 상속됨 DependencyObject)
InterpolateValue(Int16, Double)

제공된 진행률 증분으로 특정 키 프레임의 보간된 값을 반환합니다.

(다음에서 상속됨 Int16KeyFrame)
InterpolateValueCore(Int16, Double)

불연속 보간을 사용하여 이전 키 프레임 값과 현재 키 프레임 값 사이를 전환합니다.

InvalidateProperty(DependencyProperty)

지정된 종속성 속성의 유효 값을 다시 계산합니다.

(다음에서 상속됨 DependencyObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnChanged()

현재 Freezable 개체가 수정될 때 호출됩니다.

(다음에서 상속됨 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject)

방금 설정된 DependencyObjectType 데이터 멤버에 대한 적절한 컨텍스트 포인터를 설정합니다.

(다음에서 상속됨 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)

이 멤버는 WPF(Windows Presentation Foundation) 인프라를 지원하며 코드에서 직접 사용할 수 없습니다.

(다음에서 상속됨 Freezable)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

OnPropertyChanged(DependencyPropertyChangedEventArgs)DependencyObject 구현을 재정의하여 Freezable 형식의 변화하는 종속성 속성에 대한 응답으로 Changed 처리기도 호출합니다.

(다음에서 상속됨 Freezable)
ReadLocalValue(DependencyProperty)

종속성 속성의 로컬 값을 반환합니다(있는 경우).

(다음에서 상속됨 DependencyObject)
ReadPreamble()

유효한 스레드에서 Freezable에 액세스하고 있는지 확인합니다. Freezable 상속자는 종속성 속성이 아닌 데이터 멤버를 읽는 API의 시작 부분에서 이 메서드를 호출해야 합니다.

(다음에서 상속됨 Freezable)
SetCurrentValue(DependencyProperty, Object)

해당 값 소스를 변경하지 않고 종속성 속성의 값을 설정합니다.

(다음에서 상속됨 DependencyObject)
SetValue(DependencyProperty, Object)

지정된 종속성 속성 식별자를 가진 종속성 속성의 로컬 값을 설정합니다.

(다음에서 상속됨 DependencyObject)
SetValue(DependencyPropertyKey, Object)

종속성 속성의 DependencyPropertyKey 식별자에 의해 지정된 읽기 전용 종속성 속성의 로컬 값을 설정합니다.

(다음에서 상속됨 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

serialization 프로세스에서 지정된 종속성 속성의 값을 직렬화해야 하는지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 DependencyObject)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
VerifyAccess()

호출 스레드에서 이 DispatcherObject에 액세스할 수 있는지 확인합니다.

(다음에서 상속됨 DispatcherObject)
WritePostscript()

Changed 에 대한 Freezable 이벤트를 발생시키고 해당 OnChanged() 메서드를 호출합니다. Freezable에서 파생된 클래스는 종속성 속성으로 저장되지 않은 클래스 멤버를 수정하는 모든 API의 끝에서 이 메서드를 호출해야 합니다.

(다음에서 상속됨 Freezable)
WritePreamble()

Freezable이 고정되어 있지 않고 유효한 스레드 컨텍스트에서 액세스되고 있는지 확인합니다. Freezable 상속자는 종속성 속성이 아닌 데이터 멤버에 쓰는 API의 시작 부분에서 이 메서드를 호출해야 합니다.

(다음에서 상속됨 Freezable)

이벤트

Changed

Freezable 또는 여기에 들어 있는 개체가 수정될 때 발생합니다.

(다음에서 상속됨 Freezable)

명시적 인터페이스 구현

IKeyFrame.Value

KeyTime 인스턴스와 연결된 값을 가져오거나 설정합니다.

(다음에서 상속됨 Int16KeyFrame)

적용 대상

추가 정보