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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void AddZoomToAreaAnimation(PowerPoint.Shape zoomShape)
        {
            PrepareForZoomToArea(zoomShape);
            PowerPoint.Shape shapeToZoom = null, referenceShape = null;
            if (!ZoomLabSettings.BackgroundZoomChecked)
            {
                shapeToZoom    = GetShapeToZoom(zoomShape);
                referenceShape = GetReferenceShape(shapeToZoom);
                DefaultMotionAnimation.AddDefaultMotionAnimation(this, shapeToZoom, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
            }
            else
            {
                shapeToZoom = zoomSlideCroppedShapes.Duplicate()[1];
                DeleteShapeAnimations(shapeToZoom);
                LegacyShapeUtil.CopyShapePosition(zoomSlideCroppedShapes, ref shapeToZoom);

                referenceShape = GetReferenceShape(zoomShape);
                DefaultMotionAnimation.AddZoomToAreaMotionAnimation(this, shapeToZoom, zoomShape, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
            }

            shapeToZoom.Name = "PPTLabsMagnifyAreaSlide" + DateTime.Now.ToString("yyyyMMddHHmmssffff");
            referenceShape.Delete();
            zoomSlideCroppedShapes.Visible = Office.MsoTriState.msoFalse;
            indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
        }
Exemplo n.º 3
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);
                        }
                    }
                }
            }
        }
        public void AddZoomToAreaAnimation(PowerPointSlide slideToPanFrom, PowerPointSlide slideToPanTo)
        {
            PrepareForZoomToArea(slideToPanFrom, slideToPanTo);
            DefaultMotionAnimation.AddZoomToAreaPanAnimation(this, panShapeFrom, panShapeTo, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
            DefaultMotionAnimation.PreloadShape(this, panShapeFrom);

            indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
        }
Exemplo n.º 5
0
        public void AddStepBackAnimationBackground(PowerPoint.Shape shapeToZoom, PowerPoint.Shape backgroundShape, PowerPoint.Shape referenceShape)
        {
            PowerPoint.Shape indicatorShape = AddPowerPointLabsIndicator();
            DefaultMotionAnimation.AddStepBackMotionAnimation(this, shapeToZoom, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
            DefaultMotionAnimation.AddStepBackMotionAnimation(this, backgroundShape, shapeToZoom, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);

            DefaultMotionAnimation.PreloadShape(this, backgroundShape, false);
            DefaultMotionAnimation.DuplicateAsCoverImage(this, shapeToZoom);
            indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
        }
        public void AddZoomToAreaAnimation(PowerPoint.Shape zoomShape)
        {
            PrepareForZoomToArea(zoomShape);

            if (!ZoomLabSettings.BackgroundZoomChecked)
            {
                //Zoom stored shape to fit slide
                zoomSlideCroppedShapes.LockAspectRatio = Office.MsoTriState.msoTrue;
                if (zoomSlideCroppedShapes.Width > zoomSlideCroppedShapes.Height)
                {
                    zoomSlideCroppedShapes.Width = PowerPointPresentation.Current.SlideWidth;
                }
                else
                {
                    zoomSlideCroppedShapes.Height = PowerPointPresentation.Current.SlideHeight;
                }

                zoomSlideCroppedShapes.Left = (PowerPointPresentation.Current.SlideWidth / 2) - (zoomSlideCroppedShapes.Width / 2);
                zoomSlideCroppedShapes.Top  = (PowerPointPresentation.Current.SlideHeight / 2) - (zoomSlideCroppedShapes.Height / 2);

                DefaultMotionAnimation.AddDefaultMotionAnimation(this, zoomSlideCroppedShapes, zoomShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);

                //Add appear animations to existing shapes
                bool isFirst = true;
                PowerPoint.Effect effectFade = null;
                foreach (PowerPoint.Shape tmp in _slide.Shapes)
                {
                    if (!(tmp.Equals(zoomSlideCroppedShapes) || tmp.Equals(indicatorShape)))
                    {
                        if (isFirst)
                        {
                            effectFade = _slide.TimeLine.MainSequence.AddEffect(tmp, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
                        }
                        else
                        {
                            effectFade = _slide.TimeLine.MainSequence.AddEffect(tmp, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                        }

                        effectFade.Timing.Duration = 0.25f;
                        isFirst = false;
                    }
                }

                //Add fade out anmation to shape added by PPTLabs
                effectFade                 = _slide.TimeLine.MainSequence.AddEffect(zoomSlideCroppedShapes, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                effectFade.Exit            = Office.MsoTriState.msoTrue;
                effectFade.Timing.Duration = 0.25f;
            }
            else
            {
                GetShapeToZoomWithBackground(zoomShape);
                PowerPoint.Effect lastDisappearEffect = DefaultMotionAnimation.AddZoomOutMotionAnimation(this,
                                                                                                         zoomSlideCroppedShapes, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                DefaultMotionAnimation.PreloadShape(this, zoomSlideCroppedShapes);

                //Add appear animations to existing shapes
                bool isFirst = true;
                PowerPoint.Effect effectFade = null;
                foreach (PowerPoint.Shape tmp in _slide.Shapes)
                {
                    if (!(tmp.Equals(zoomSlideCroppedShapes) || tmp.Equals(indicatorShape)) && !(tmp.Name.Contains("PPTLabsMagnifyShape")) && !(tmp.Name.Contains("PPTLabsMagnifyArea")))
                    {
                        tmp.Visible = Office.MsoTriState.msoTrue;
                        if (isFirst)
                        {
                            effectFade = _slide.TimeLine.MainSequence.AddEffect(tmp, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
                        }
                        else
                        {
                            effectFade = _slide.TimeLine.MainSequence.AddEffect(tmp, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                        }

                        effectFade.Timing.Duration = 0.01f;
                        isFirst = false;
                    }
                }

                //Move last frame disappear animation to end
                lastDisappearEffect.MoveTo(_slide.TimeLine.MainSequence.Count);
                lastDisappearEffect.Timing.TriggerType      = PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious;
                lastDisappearEffect.Timing.TriggerDelayTime = 0.01f;
            }

            indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
        }