Re: [Unity] v1.2 Preview
Posted: 27 Oct 2014, 20:41
So they finally made Unity 5 open for all pro users. Will this build work in Unity 5?
Welcome to our official discussion site. You’ll find topics on features, bugs, development, and general support here
https://www.noesisengine.com/forums/
pbReload = FindName<Noesis.ProgressBar>("pbReload");
sbReload = root.FindResource<Storyboard>("sbReload");
sbReload.Completed += sbReload_Completed;
sbReload.Begin(pbReload, pbReload, true);
void sbReload_Completed(object sender, TimelineEventArgs e)
{
//This never fires
pbReload.Value = 0;
}
As I explained here: viewtopic.php?f=3&t=547&hilit=fillbehavior#p2801Is there any reason why the storyboard completed function never fires?
Edit: it does in fact fire but it won't let me set the value of the progressbar back to 0 it just stays at 100.
Code: Select allpbReload = FindName<Noesis.ProgressBar>("pbReload"); sbReload = root.FindResource<Storyboard>("sbReload"); sbReload.Completed += sbReload_Completed; sbReload.Begin(pbReload, pbReload, true); void sbReload_Completed(object sender, TimelineEventArgs e) { //This never fires //pbReload.Value = 0; }
So you probably want to Clear the animation value to reset the ProgressBar value.DependencyProperty follows a value precedence scheme to determine how to obtain the effective value of the property. As you can see in the previous link, an animated value has precedence over a local value (when you do a SetValue).
So when a property is animated, and you want to set a new value in code, you need to clear the property first:I have to check again the behavior of WPF, but I think it should be done the same way.Code: Select allrectangle.ClearAnimation(Shape.StrokeThicknessProperty); rectangle.SetStrokeThickness(2.0f);
Anyway I'm seeing we have a different API compared to WPF, we will change it to make code compatible between WPF and Noesis.
The animation value is just another value source, in fact the animation value is not modifying the local value (that remains the same during all the animation duration). You can specify how your storyboard behaves when the animation completes by setting the FillBehavior property:
- <Storyboard x:Key="anim"> or <Storyboard x:Key="anim" FillBehavior="HoldEnd"> is the default behavior, that will maintain the last animated value after animation ends.
- <Storyboard x:Key="anim" FillBehavior="Stop"> will remove last animated value after animation ends, so the local (or any other value with less precedence) will be recovered.
Changing Storyboard.Duration doesn't change the duration of the inner animation timelines (it works the same in WPF). You probably want to change Storyboard.SpeedRatio to modify the effective duration of all the animation timelines in the Storyboard.I guess I should also note it doesn't look like setting the duration of the storyboard is working in code.I get the same result for both of these it looks like it just lasts for about 1 second.Code: Select allsb.Duration = new Duration(new Timespan(0,0,5)); // 5 seconds sb.Duration = new TimeSpan(0,0,5); // 5 seconds