Daki
Topic Author
Posts: 57
Joined: 16 Aug 2013, 00:48

Replaying a Storyboard

18 Dec 2013, 02:48

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:
		<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>
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?
 
User avatar
sfernandez
Site Admin
Posts: 1911
Joined: 22 Dec 2011, 19:20

Re: Replaying a Storyboard

18 Dec 2013, 20:43

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".
 
Daki
Topic Author
Posts: 57
Joined: 16 Aug 2013, 00:48

Re: Replaying a Storyboard

19 Dec 2013, 00:57

:oops:
Whoops! That was it. Thanks!
 
User avatar
sfernandez
Site Admin
Posts: 1911
Joined: 22 Dec 2011, 19:20

Re: Replaying a Storyboard

19 Dec 2013, 02:13

;)

Who is online

Users browsing this forum: No registered users and 1 guest