private void AnimateMatchingShapes(PowerPoint.Shape[] currentSlideShapes, PowerPoint.Shape[] nextSlideSlideShapes, int[] matchingShapeIDs)
        {
            int matchingShapeIndex;

            foreach (PowerPoint.Shape sh in _slide.Shapes)
            {
                if (matchingShapeIDs.Contains(sh.Id))
                {
                    matchingShapeIndex = Array.IndexOf(matchingShapeIDs, sh.Id);
                    if (matchingShapeIndex < matchingShapeIDs.Count() && sh.Id == matchingShapeIDs[matchingShapeIndex])
                    {
                        DeleteShapeAnimations(sh);
                        PowerPoint.MsoAnimTriggerType trigger = (matchingShapeIndex == 0) ? PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious : PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious;
                        if (NeedsFrameAnimation(sh, nextSlideSlideShapes[matchingShapeIndex]))
                        {
                            FrameMotionAnimation.animationType = FrameMotionAnimation.FrameMotionAnimationType.kAutoAnimate;
                            FrameMotionAnimation.AddFrameMotionAnimation(this, sh, nextSlideSlideShapes[matchingShapeIndex], AutoAnimate.defaultDuration);
                        }
                        else
                        {
                            DefaultMotionAnimation.AddDefaultMotionAnimation(this, sh, nextSlideSlideShapes[matchingShapeIndex], AutoAnimate.defaultDuration, trigger);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void AnimateMatchingShapes(PowerPoint.Shape[] currentSlideShapes, PowerPoint.Shape[] nextSlideSlideShapes, int[] matchingShapeIDs)
        {
            int matchingShapeIndex;

            // Copy the shapes as the list may be modified when iterating
            PowerPoint.Shape[] slideShapesCopy = new PowerPoint.Shape[_slide.Shapes.Count];
            for (int i = 0; i < slideShapesCopy.Length; i++)
            {
                slideShapesCopy[i] = _slide.Shapes[i + 1];
            }

            foreach (PowerPoint.Shape sh in slideShapesCopy)
            {
                if (matchingShapeIDs.Contains(sh.Id))
                {
                    matchingShapeIndex = Array.IndexOf(matchingShapeIDs, sh.Id);
                    if (matchingShapeIndex < matchingShapeIDs.Count() && sh.Id == matchingShapeIDs[matchingShapeIndex])
                    {
                        DeleteShapeAnimations(sh);
                        PowerPoint.MsoAnimTriggerType trigger = (matchingShapeIndex == 0) ? PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious : PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious;
                        if (NeedsFrameAnimation(sh, nextSlideSlideShapes[matchingShapeIndex]))
                        {
                            FrameMotionAnimation.animationType = FrameMotionAnimation.FrameMotionAnimationType.kAutoAnimate;
                            FrameMotionAnimation.AddFrameMotionAnimation(this, sh, nextSlideSlideShapes[matchingShapeIndex], AnimationLabSettings.AnimationDuration);
                        }
                        else
                        {
                            DefaultMotionAnimation.AddDefaultMotionAnimation(this, sh, nextSlideSlideShapes[matchingShapeIndex], AnimationLabSettings.AnimationDuration, trigger);
                        }
                    }
                }
            }
        }