Timeline.DesiredFrameRate 연결된 속성

정의

이 Timeline과 자식 Timeline의 원하는 프레임 속도를 가져오거나 설정합니다.

see GetDesiredFrameRate, and SetDesiredFrameRate
see GetDesiredFrameRate, and SetDesiredFrameRate
see GetDesiredFrameRate, and SetDesiredFrameRate

예제

다음 예제에서는 DesiredFrameRate 속성을 사용하여 여러 애니메이션을 초당 10프레임으로 제한합니다.

<!-- DesiredFrameRateExample.xaml
     This example shows how to use the DesiredFrameRate property. 
     Two DrawingBrushes are animated. The desired frame rate is
     set on one group of animations but not the other, for comparison. -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="DesiredFrameRate Example" Background="White">
  <Page.Resources>
  
    <!-- The Drawing used by the animated DrawingBrush. -->
    <DrawingGroup x:Key="CheckerDrawing">
      <GeometryDrawing Brush="White">
        <GeometryDrawing.Geometry>
          <RectangleGeometry Rect="0,0,100,100" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing Brush="Gray">
        <GeometryDrawing.Geometry>
          <RectangleGeometry Rect="0,0,50,50" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing Brush="Gray">
        <GeometryDrawing.Geometry>
          <RectangleGeometry Rect="50,50,50,50" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>        
    </DrawingGroup>
  </Page.Resources>

  <StackPanel Margin="10">  
    <Rectangle 
      Width="200" Height="200" Margin="10"
      Stroke="Black" StrokeThickness="1" >
      <Rectangle.Fill>
        <DrawingBrush 
          Drawing="{StaticResource CheckerDrawing}"
          Viewport="0,0,50,50" 
          ViewportUnits="Absolute"
          TileMode="Tile"> 
          <DrawingBrush.RelativeTransform>
            <TransformGroup>
              <RotateTransform 
                x:Name="AnimatedRotateTransform1"
                CenterX="0.5" CenterY="0.5" />
              <ScaleTransform
                x:Name="AnimatedScaleTransform1"
                CenterX="0.5" CenterY="0.5" />
            </TransformGroup>
          </DrawingBrush.RelativeTransform>
        </DrawingBrush> 
      </Rectangle.Fill>
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.Loaded">
          <BeginStoryboard>
          
            <!-- Set the desired framerate on the root timeline. 
                 The animations that belong to this storyboard
                 will be limited to 10 frames per second. -->
            <Storyboard Timeline.DesiredFrameRate="10">
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedRotateTransform1"
                Storyboard.TargetProperty="Angle"
                From="0" To="360" 
                Duration="0:1:00" 
                AutoReverse="True"
                RepeatBehavior="Forever"
                />
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedScaleTransform1"
                Storyboard.TargetProperty="ScaleX"
                From="1" To="5" 
                Duration="0:0:30" 
                AutoReverse="True"
                RepeatBehavior="Forever"
                />
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedScaleTransform1"
                Storyboard.TargetProperty="ScaleY"
                From="1" To="5" 
                Duration="0:0:45" 
                AutoReverse="True"
                RepeatBehavior="Forever"
                />               
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>
 
    <Rectangle 
      Width="200" Height="200" Margin="10"
      Stroke="Black" StrokeThickness="1">
      <Rectangle.Fill>
        <DrawingBrush 
          Drawing="{StaticResource CheckerDrawing}"
          Viewport="0,0,50,50" 
          ViewportUnits="Absolute"
          TileMode="Tile">
          <DrawingBrush.RelativeTransform>
            <TransformGroup>
              <RotateTransform 
                x:Name="AnimatedRotateTransform2"
                CenterX="0.5" CenterY="0.5" />
              <ScaleTransform
                x:Name="AnimatedScaleTransform2"
                CenterX="0.5" CenterY="0.5" />
            </TransformGroup>
          </DrawingBrush.RelativeTransform>
        </DrawingBrush> 
      </Rectangle.Fill>
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.Loaded">
          <BeginStoryboard>
          
            <!-- The animations that belong to this storyboard
                 will run at full speed. -->
            <Storyboard>
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedRotateTransform2"
                Storyboard.TargetProperty="Angle"
                From="0" To="360" 
                Duration="0:1:00" 
                AutoReverse="True"
                RepeatBehavior="Forever"
                />
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedScaleTransform2"
                Storyboard.TargetProperty="ScaleX"
                From="1" To="5" 
                Duration="0:0:30" 
                AutoReverse="True"
                RepeatBehavior="Forever"
                />
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedScaleTransform2"
                Storyboard.TargetProperty="ScaleY"
                From="1" To="5" 
                Duration="0:0:45" 
                AutoReverse="True"
                RepeatBehavior="Forever"
                />               
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>      
    </Rectangle> 
  
  
  </StackPanel>
  
    


</Page>

설명

이 속성을 사용하여 애니메이션이 실행되어야 하는 특정 프레임 속도를 정의합니다.이는 지침일 뿐이며 보장된 값이 아닙니다. 이 속성에는 두 가지 기본 용도가 있습니다.

  • 높은 수준의 충실도가 필요하지 않은 느리게 움직이는 백그라운드 형식 애니메이션에 대한 처리 리소스 양을 제한합니다. 타임라인에서 작은 프레임 속도 값을 설정하여 이 작업을 수행할 수 있습니다.

  • 빠르게 움직이는 가로 애니메이션에 대한 분할의 시각적 영향을 줄입니다. 이는 타임라인에서 높은 프레임 속도 값을 설정하여 달성할 수 있습니다.

이 속성은 루트 타임라인에서만 설정할 수 있습니다.

적용 대상

추가 정보