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); }
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); } } } } }
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 AddDrillDownAnimationBackground(PowerPoint.Shape backgroundShape, PowerPoint.Shape shapeToZoom, PowerPoint.Shape referenceShape) { PowerPoint.Shape indicatorShape = AddPowerPointLabsIndicator(); DefaultMotionAnimation.AddDrillDownMotionAnimation(this, backgroundShape, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious); DefaultMotionAnimation.AddDefaultMotionAnimation(this, shapeToZoom, backgroundShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious); DefaultMotionAnimation.PreloadShape(this, shapeToZoom, false); DefaultMotionAnimation.DuplicateAsCoverImage(this, backgroundShape); 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); }