Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF正在非常不稳定地运行动画。我做错了什么?_C#_Wpf_Animation - Fatal编程技术网

C# WPF正在非常不稳定地运行动画。我做错了什么?

C# WPF正在非常不稳定地运行动画。我做错了什么?,c#,wpf,animation,C#,Wpf,Animation,这是我的密码。这是至关重要的,旋转运行尽可能顺利,但当我运行它是非常颠簸,我真的不知道为什么 <Window.Resources > <BooleanToVisibilityConverter x:Key="booleanToVisConverter" /> <Storyboard x:Key="AnimationStoryboard"> <DoubleAnimation Storyboard.T

这是我的密码。这是至关重要的,旋转运行尽可能顺利,但当我运行它是非常颠簸,我真的不知道为什么

<Window.Resources >
    <BooleanToVisibilityConverter x:Key="booleanToVisConverter" />
    <Storyboard x:Key="AnimationStoryboard">
        <DoubleAnimation 
            Storyboard.TargetName="RenderingImage"
            Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
            From="0" To="{Binding To}" Duration="{Binding Duration}"
            RepeatBehavior="Forever" SpeedRatio="0.25" FillBehavior="Stop" />
    </Storyboard>
</Window.Resources>
<Window.DataContext>
    <viewModel:AnimationViewModel />
</Window.DataContext>
<Window.InputBindings>
    <KeyBinding Key="Escape" Command="{Binding EscapeSession}" />
    <KeyBinding Key="Enter" Command="{Binding RunSession}"/>
</Window.InputBindings>
<i:Interaction.Triggers >
    <i:EventTrigger EventName="Loaded" >
        <i:InvokeCommandAction Command="{Binding AnimationLoaded}" />
    </i:EventTrigger>
</i:Interaction.Triggers>
<Grid Background="Black" RenderTransformOrigin="0.5 0.5">
    <Grid.RenderTransform >
        <ScaleTransform ScaleX="1.7" ScaleY="1.7" CenterX="0.5" CenterY="0.5" />
    </Grid.RenderTransform>
    <TextBlock Text="{Binding TimeSpan}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
    <Image Source="{Binding MemoryMappedImage}" x:Name="RenderingImage"
           Visibility="{Binding IsVisible,Converter={StaticResource booleanToVisConverter}}"
           RenderTransformOrigin="0.5 0.5">
        <Image.RenderTransform >
            <RotateTransform CenterX="0.5" CenterY="0.5" Angle="0" />
        </Image.RenderTransform>
    </Image>
</Grid>

{Binding TimeSpan}多久更新一次?这是一个倒计时元素,但在动画旋转图像时它不运行。当它运行到秒级时。动画运行缓慢吗?当持续时间长和/或速比很低时,它可能看起来很邋遢。奇怪的是,它开始滞后,放松它需要赶上,加快冲洗-清洗-重复。我可以在W Double动画中将dispatcher priority更改为high吗?