UIElement.BeginAnimation 메서드

정의

이 요소에서 지정된 애니메이션 속성에 대한 애니메이션을 시작합니다.

오버로드

BeginAnimation(DependencyProperty, AnimationTimeline)

이 요소에서 지정된 애니메이션 속성에 대한 애니메이션을 시작합니다.

BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

속성에 이미 실행 중인 애니메이션이 있는 경우 수행할 동작을 지정하는 옵션을 사용하여 이 요소의 지정된 애니메이션 속성에 대해 특정 애니메이션을 시작합니다.

BeginAnimation(DependencyProperty, AnimationTimeline)

이 요소에서 지정된 애니메이션 속성에 대한 애니메이션을 시작합니다.

public:
 virtual void BeginAnimation(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationTimeline ^ animation);
public void BeginAnimation (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationTimeline animation);
abstract member BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline -> unit
override this.BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline -> unit
Public Sub BeginAnimation (dp As DependencyProperty, animation As AnimationTimeline)

매개 변수

dp
DependencyProperty

종속성 속성 식별자로 지정된, 애니메이션을 지정할 속성입니다.

animation
AnimationTimeline

시작할 애니메이션의 Timeline입니다.

구현

예제

다음 예제에서는 애니메이션을 만들고 할당한 다음 호출 BeginAnimation 하여 시작합니다.

// Animate the button's width.
DoubleAnimation widthAnimation = 
    new DoubleAnimation(120, 300, TimeSpan.FromSeconds(5));
widthAnimation.RepeatBehavior = RepeatBehavior.Forever;
widthAnimation.AutoReverse = true;
animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation);
' Animate the button's width.
Dim widthAnimation As New DoubleAnimation(120, 300, TimeSpan.FromSeconds(5))
widthAnimation.RepeatBehavior = RepeatBehavior.Forever
widthAnimation.AutoReverse = True
animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation)

설명

속성에 애니메이션이 적용되었는지 여부를 확인하면 애니메이션이 시작되고 애니메이션이 아닌 시작 지점을 벗어난 첫 번째 프레임이 렌더링될 때 애니메이션이 애니메이션으로 간주됩니다.

for animationBeginTime null면 현재 애니메이션이 제거되고 속성의 현재 값이 유지됩니다.

전체 animation 값이 null면 모든 애니메이션이 속성에서 제거되고 속성 값이 기본 값으로 되돌아갑니다. 그러나 원래 연결된 애니메이션 타임라인은 중지되지 않습니다. 해당 타임라인에 할당된 다른 모든 애니메이션은 계속 실행됩니다.

적용 대상

BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

속성에 이미 실행 중인 애니메이션이 있는 경우 수행할 동작을 지정하는 옵션을 사용하여 이 요소의 지정된 애니메이션 속성에 대해 특정 애니메이션을 시작합니다.

public:
 virtual void BeginAnimation(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationTimeline ^ animation, System::Windows::Media::Animation::HandoffBehavior handoffBehavior);
public void BeginAnimation (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationTimeline animation, System.Windows.Media.Animation.HandoffBehavior handoffBehavior);
abstract member BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline * System.Windows.Media.Animation.HandoffBehavior -> unit
override this.BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline * System.Windows.Media.Animation.HandoffBehavior -> unit
Public Sub BeginAnimation (dp As DependencyProperty, animation As AnimationTimeline, handoffBehavior As HandoffBehavior)

매개 변수

dp
DependencyProperty

종속성 속성 식별자로 지정된, 애니메이션을 지정할 속성입니다.

animation
AnimationTimeline

적용할 애니메이션의 Timeline입니다.

handoffBehavior
HandoffBehavior

새 애니메이션이 이미 속성 값에 영향을 주고 있는 현재(실행 중인) 애니메이션과 상호 작용하는 방법을 지정하는 열거형 값입니다.

구현

예제

다음 예제에서는 리소스에서 기존 애니메이션을 가져온 다음 지정된 핸드오프 동작으로 호출 BeginAnimation 하는 처리기를 구현합니다.

private void myFrameNavigated(object sender, NavigationEventArgs args)
{
    DoubleAnimation myFadeInAnimation = (DoubleAnimation)this.Resources["MyFadeInAnimationResource"];
    myFrame.BeginAnimation(Frame.OpacityProperty, myFadeInAnimation, HandoffBehavior.SnapshotAndReplace);
}
Private Sub myFrameNavigated(ByVal sender As Object, ByVal args As NavigationEventArgs)
    Dim myFadeInAnimation As DoubleAnimation = CType(Me.Resources("MyFadeInAnimationResource"), DoubleAnimation)
    myFrame.BeginAnimation(Frame.OpacityProperty, myFadeInAnimation, HandoffBehavior.SnapshotAndReplace)
End Sub

설명

속성에 애니메이션이 적용되었는지 여부를 확인하면 애니메이션이 시작되고 애니메이션이 아닌 시작 지점을 벗어난 첫 번째 프레임이 렌더링될 때 애니메이션이 애니메이션으로 간주됩니다.

for animationBeginTime null면 현재 애니메이션이 제거되고 속성의 현재 값이 유지됩니다.

전체 animation 값이 null면 모든 애니메이션이 속성에서 제거되고 속성 값이 기본 값으로 되돌아갑니다. 그러나 원래 연결된 애니메이션 타임라인은 중지되지 않습니다. 해당 타임라인에 할당된 다른 모든 애니메이션은 계속 실행됩니다.

적용 대상