Replaying a Storyboard
Looking through WPF discussions it seems the recommended way to replay a Storyboard is to use the Seek function to reset it to the beginning, though this function is not supported in Noesis. I have a simple Storyboard which I play based on certain events in my game:
When it plays the first time it is correct. But subsequent times it appears to play very slowly, but still ends 2 seconds in. How can I properly reset this Storyboard to the beginning state and replay it without using Seek?
Code: Select all
<Storyboard x:Name="bluewarninganim">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="bluewarningimage">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="bluewarningimage">
<EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
-
-
sfernandez
Site Admin
- Posts: 3239
- Joined:
Re: Replaying a Storyboard
Storyboards can be replayed many times by calling Storyboard.Begin().
Just take into account, that storyboard will animate element properties from the current state.
I see in your Storyboard that the animation timeline that modifies the ScaleY property does not have a value for KeyTime="0", so the second time you play the Storyboard on the same object, ScaleY will start from "0" and being animated during 1.9 secs until it reaches "1". Maybe this is the source of what you are explaining as "playing slow".
Just take into account, that storyboard will animate element properties from the current state.
I see in your Storyboard that the animation timeline that modifies the ScaleY property does not have a value for KeyTime="0", so the second time you play the Storyboard on the same object, ScaleY will start from "0" and being animated during 1.9 secs until it reaches "1". Maybe this is the source of what you are explaining as "playing slow".
Who is online
Users browsing this forum: Ahrefs [Bot] and 36 guests