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);
        }
Пример #2
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);
        }