【问题标题】:Reverse storyboard on pointer release windows 8.1指针释放窗口 8.1 上的反向故事板
【发布时间】:2023-03-26 04:33:01
【问题描述】:

我在按钮中的视觉状态指针中有这个故事板:

<VisualState x:Name="PointerOver">
   <Storyboard x:Name="Storyboard1" AutoReverse="True">
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="image">
     <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="20"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="40"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="60"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="80"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.5" Value="100"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.6" Value="120"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.7" Value="140"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="160"/>
     <SplineDoubleKeyFrame KeyTime="0:0:0.9" Value="180"/>
     </DoubleAnimationUsingKeyFrames>
   </Storyboard>
</VisualState>

我想在指针释放中从停止点而不是从结束点反转这个故事板

这可能吗??

【问题讨论】:

    标签: xaml storyboard windows-store-apps windows-8.1


    【解决方案1】:

    您可以为此使用VisualStateGroup

    pointerRelease 事件选择Normal 状态。

       <VisualStateManager.VisualStateGroups>            
              <VisualStateGroup x:Name="CommonStates">
                          <VisualState x:Name="Normal" />
                          <VisualState x:Name="PointerOver">
                                    <Storyboard x:Name="Storyboard1" AutoReverse="True">
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="image">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="20"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="40"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="60"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="80"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.5" Value="100"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.6" Value="120"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.7" Value="140"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="160"/>
                                            <SplineDoubleKeyFrame KeyTime="0:0:0.9" Value="180"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                    </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>            
    

    【讨论】:

    • 好的,但是我从 180 开始以正常的视觉状态开始故事板,但是一旦指针释放,我想从该点开始
    猜你喜欢
    • 2021-01-12
    • 1970-01-01
    • 2014-06-06
    • 1970-01-01
    • 2014-06-22
    • 2013-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多