public bool RemoveAnimation([NotNull] AnimationWrapper animation) { if (animation == null) { throw new ArgumentNullException(nameof(animation)); } return(RemoveAnimation(animation.Name)); }
public bool AddAnimation([NotNull] AnimationWrapper animation) { if (animation == null) { throw new ArgumentNullException(nameof(animation)); } if (_animationCache.ContainsKey(animation.Name)) { return(false); } _animationCache.Add(animation.Name, animation); return(true); }
private void BeginAnimationImpl( AnimationWrapper animationWrapper, UIElement element, Action <AnimationTimeline> modifiers = null) { var animation = _animationObjectPoolers[animationWrapper.Name].GetObject(); modifiers?.Invoke(animation); if (animationWrapper.OnCompleted != null) { var kvp = new KeyValuePair <UIElement, AnimationWrapper>(element, animationWrapper); if (_elementToAnimationCache.Add(kvp)) { animation.Completed += (sender, args) => animationWrapper.OnCompleted(sender, args, element); } } element.BeginAnimation(animationWrapper.TargetProperty, animation); }