Programmatic Storyboard Creation
I'm getting this warning, but I am not sure what it means.
I tried making the storyboard controllable via the overload, but the warning persists. Is there something I can do to avoid creating this wanring?
Code: Select all
[NOESIS/W] Can't Stop Storyboard, it was initiated with a different Target
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
NoesisUnity:UnityLog (int,string) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.1/Runtime/NoesisUnity.cs:355)
Noesis.Storyboard:Stop () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.1/Runtime/API/Proxies/Storyboard.cs:193
Code: Select all
public static Storyboard ResizeHeight(this FrameworkElement frameworkElement, FrameworkElement parent, float height, TimeSpan duration, Action completed = null)
{
if (parent == null)
throw new NullReferenceException("parent");
if (BaseComponent.getCPtr(parent).Handle == IntPtr.Zero)
throw new NullReferenceException("parent");
string key = "Resize" + frameworkElement.GetHashCode();
StopStoryboard(key, parent);
if (parent.Resources.Contains(key))
{
UnityEngine.Debug.LogWarning("Resource already exists");
return null;
}
DoubleAnimation animation = new DoubleAnimation();
animation.Duration = new Duration(duration);
animation.AutoReverse = false;
animation.FillBehavior = FillBehavior.Stop;
Storyboard storyboard = new Storyboard();
storyboard.AutoReverse = false;
storyboard.Duration = animation.Duration;
storyboard.FillBehavior = FillBehavior.Stop;
storyboard.Children.Add(animation);
parent.Resources.Add(key, storyboard);
Storyboard.SetTarget(animation, frameworkElement);
Storyboard.SetTargetProperty(animation, new PropertyPath("Height"));
animation.From = frameworkElement.Height;
animation.To = height.Value;
storyboard.Completed += (sender2, e2) =>
{
parent.Resources.Remove(key);
frameworkElement.Height = height.Value;
completed?.Invoke();
};
storyboard.Begin();
return storyboard;
}
Re: Programmatic Storyboard Creation
I think you should call the other "Begin" method overload that accepts a FrameworkElement
Happy to a find a familiar Unity Forums user here! Not lot of Unity devs use Noesis, I presume you're coming from a WPF/Silverlight background?
Code: Select all
storyboard.Begin(frameworkElement);
Re: Programmatic Storyboard Creation
Thank you - that was the cause!
Yes, I have a background in WPF and Silverlight. I'm comfortable with many UI frameworks (HTML/CSS, Swing, QT, Windows Forms, WPF...). Noesis is just terrific and their investment in the quality of the product really shows.
Yes, I have a background in WPF and Silverlight. I'm comfortable with many UI frameworks (HTML/CSS, Swing, QT, Windows Forms, WPF...). Noesis is just terrific and their investment in the quality of the product really shows.
Re: Programmatic Storyboard Creation
Yes it's awesome! when I found Noesis the first time, I couldn't believe my eyes! being able to transfer my long experience in WPF/Silverlight/Xamarin.Forms to Unity (and avoid using its awful UI system as a bonus) is like being in heaven.
-
sfernandez
Site Admin
- Posts: 3013
- Joined:
Re: Programmatic Storyboard Creation
Thanks for the kind words :)
Who is online
Users browsing this forum: No registered users and 5 guests