public static string Begin(this Storyboard storyboard, StoryboardFinishedCallback finishedCallback = null) { var handle = storyboard.Id.ToString(); Begin(storyboard, handle, finishedCallback); return(handle); }
public static string Begin(this Storyboard storyboard, VisualElement animationRoot, StoryboardFinishedCallback finishedCallback = null) { var handle = storyboard.Id.ToString(); Begin(storyboard, animationRoot, handle, finishedCallback); return(handle); }
public static void Begin(this Storyboard storyboard, string handle, StoryboardFinishedCallback finishedCallback = null) { if (storyboard.Target == null) { throw new InvalidOperationException( "Impossible to begin animations when animation stroryboard target null"); } Begin(storyboard, storyboard.Target, finishedCallback); }
public static void Begin(this Storyboard storyboard, VisualElement animationRoot, string handle, StoryboardFinishedCallback finishedCallback = null) { if (animationRoot == null) { throw new ArgumentNullException(nameof(animationRoot)); } if (string.IsNullOrWhiteSpace(handle)) { throw new InvalidOperationException("Impossible to begin animations when handle is empty"); } var duration = storyboard.Duration; var animationLength = (uint)duration.ToTimeSpan().TotalMilliseconds; var animation = storyboard.ToAnimation(storyboard.Target ?? animationRoot); animationRoot.Animate(handle, animation, length: animationLength, finished: (x, cancelled) => finishedCallback?.Invoke(animation, x, cancelled)); }