ObjectAnimationUsingKeyFrames 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 개체 이상의 집합을 따라 Object 속성의 KeyFrames 값에 애니메이션 효과를 니다 Duration.
UWP에 해당하는 WinUI 2 API: Microsoft.UI.Xaml.Media.Animation.ObjectAnimationUsingKeyFrames(Windows 앱 SDK WinUI의 경우 Windows 앱 SDK 네임스페이스 참조).
public ref class ObjectAnimationUsingKeyFrames sealed : Timeline
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
class ObjectAnimationUsingKeyFrames final : Timeline
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ObjectAnimationUsingKeyFrames final : Timeline
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
public sealed class ObjectAnimationUsingKeyFrames : Timeline
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="KeyFrames")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ObjectAnimationUsingKeyFrames : Timeline
Public NotInheritable Class ObjectAnimationUsingKeyFrames
Inherits Timeline
<ObjectAnimationUsingKeyFrames>oneOrMoreDiscreteObjectKeyFrames</ObjectAnimationUsingKeyFrames>
- 상속
- 특성
Windows 요구 사항
| 디바이스 패밀리 |
Windows 10 (10.0.10240.0에서 도입되었습니다.)
|
| API contract |
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)
|
예제
다음 예제에서는 ObjectAnimationUsingKeyFrames 클래스를 Fill Rectangle사용하여 . 이 애니메이션은 다음과 같은 방식으로 두 개의 키 프레임을 사용합니다.
- 를 DiscreteObjectKeyFrameFill 사용하면 애니메이션의 Rectangle 처음 2초 후의 LinearGradientBrush 속성이 갑자기 변경됩니다.
- 애니메이션 Fill 의 세 번째 초 후 속성이 갑자기 다른 LinearGradientBrush값으로 변경되며 애니메이션이 끝날 때까지 유지됩니다(총 4초).
<StackPanel>
<StackPanel.Resources>
<Storyboard x:Name="myStoryboard">
<!-- ObjectAnimationUsingKeyFrames is used to animate properties that take
an object as a value. This animation lasts for 4 seconds using 3 KeyFrames which
swap different brush objects at regular intervals, making the background of the Page
change. -->
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="animatedRectangle"
Storyboard.TargetProperty="Fill"
Duration="0:0:4" RepeatBehavior="Forever">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<!-- Note: Only discrete interpolation (DiscreteObjectKeyFrame) is available for
use with ObjectAnimationUsingKeyFrames which merely swaps objects according to
a specified timeline. Other types of interpolation are too problematic to apply
to objects. -->
<!-- Using a DiscreteObjectKeyFrame, the Fill property of the Rectangle suddenly
changes to a LinearGradientBrush after the first two seconds of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:2">
<DiscreteObjectKeyFrame.Value>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<!-- After the third second of the animation, the Fill property is suddenly changed
to a different LinearGradientBrush which remains until the end of the animation
(4 seconds total). -->
<DiscreteObjectKeyFrame KeyTime="0:0:3">
<DiscreteObjectKeyFrame.Value>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="Black" Offset="1.0" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</StackPanel.Resources>
<!-- The Fill property of this rectangle is animated. -->
<Rectangle x:Name="animatedRectangle" Loaded="Rectangle_Loaded" Width="300" Height="300" />
</StackPanel>
// When the rectangle loads, begin the animation.
private void Rectangle_Loaded(object sender, RoutedEventArgs e)
{
myStoryboard.Begin();
}
' When the rectangle loads, begin the animation.
Private Sub Rectangle_Loaded(ByVal sender As Object, ByVal e As EventArgs)
myStoryboard.Begin()
End Sub
생성자
| ObjectAnimationUsingKeyFrames() |
ObjectAnimationUsingKeyFrames 클래스의 새 인스턴스를 초기화합니다. |
속성
메서드
이벤트
| Completed |
개체 재생이 Storyboard 완료되면 발생합니다. UWP에 해당하는 WinUI 2 API: Microsoft.UI.Xaml.Media.Animation.Timeline.Completed(Windows 앱 SDK WinUI의 경우 Windows 앱 SDK 네임스페이스 참조). (다음에서 상속됨 Timeline) |
적용 대상
추가 정보
피드백
다음에 대한 사용자 의견 제출 및 보기