internal bool StartAnimationGroup(ICompositionAnimationBase grp, string target, ExpressionVariant finalValue)
        {
            if (grp is CompositionAnimation animation)
            {
                return(StartAnimationGroupPart(animation, target, finalValue));
            }
            if (grp is CompositionAnimationGroup group)
            {
                var matched = false;
                foreach (var a in group.Animations)
                {
                    if (a.Target == null)
                    {
                        throw new ArgumentException("Animation Target can't be null");
                    }
                    if (StartAnimationGroupPart(a, target, finalValue))
                    {
                        matched = true;
                    }
                }

                return(matched);
            }

            throw new ArgumentException();
        }
Beispiel #2
0
        public static T SetImplicitAnimation <T>(this T composition, string path, ICompositionAnimationBase animation)
            where T : CompositionObject
        {
            if (composition.ImplicitAnimations == null)
            {
                composition.ImplicitAnimations = composition.Compositor.CreateImplicitAnimationCollection();
            }

            composition.ImplicitAnimations[path] = animation;
            return(composition);
        }
 /// <summary>
 /// Starts an animation group.
 /// The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup.
 /// All the animations in the group will be started at the same time on the object.
 /// </summary>
 public void StartAnimationGroup(ICompositionAnimationBase grp)
 {
     if (grp is CompositionAnimation animation)
     {
         if (animation.Target == null)
         {
             throw new ArgumentException("Animation Target can't be null");
         }
         StartAnimation(animation.Target, animation);
     }
     else if (grp is CompositionAnimationGroup group)
     {
         foreach (var a in group.Animations)
         {
             if (a.Target == null)
             {
                 throw new ArgumentException("Animation Target can't be null");
             }
             StartAnimation(a.Target, a);
         }
     }
 }
 public ElementSet <T> SetImplicitHideAnimation(ICompositionAnimationBase animation) => ForEach(e => ElementCompositionPreview.SetImplicitHideAnimation(e, animation));
Beispiel #5
0
 public static void SetHideAnimation(this UIElement element, ICompositionAnimationBase animation)
 {
     ElementCompositionPreview.SetImplicitHideAnimation(element, animation);
 }
Beispiel #6
0
        public static FrameworkElement SetImplicitAnimation(this FrameworkElement element, string path, ICompositionAnimationBase animation)
        {
            CompositionObject composition = ElementCompositionPreview.GetElementVisual(element);

            if (composition.ImplicitAnimations == null)
            {
                composition.ImplicitAnimations = composition.Compositor.CreateImplicitAnimationCollection();
            }

            if (animation == null)
            {
                composition.ImplicitAnimations.Remove(path);
            }
            else
            {
                composition.ImplicitAnimations[path] = animation;
            }
            return(element);
        }
 public static FrameworkElement SetImplicitAnimation(this FrameworkElement element, string path, ICompositionAnimationBase animation)
 {
     SetImplicitAnimation(GetElementVisual(element), path, animation);
     return element;
 }