I want to use the pptx libraries to animate shapes to appear and then disappear.
I’ve located documentation on how make things appear and that’s working just fine, but I’m not seeing how to animate something to disappear. Specifically, I want the slide to start by fading in shape 1, then after a few seconds, make shape 1 fade out as shape 2 fades in.
Thanks in advance for your assistance.
Hi Ryder,
Thank you for your reply. Your link does provide some good information about how to create a sequence of animations, however, it doesn’t completely answer my question. Please let me explain further.
I have the following line:
slide.Timeline.MainSequence.AddEffect(shape, EffectTypeEx.Appear, EffectSubtypeEx.None, EffectTriggerTypeEx.AfterPrevious);
I would like to do something like:
slide.Timeline.MainSequence.AddEffect(shape, EffectTypeEx.Disappear, EffectSubtypeEx.None, EffectTriggerTypeEx.AfterPrevious);
However, that doesn’t appear to be an option. In general I’m seeing how to animate something to appear but I’m missing what you do to make it disappear.
Hi Ryder,
public static void AddAnimcation(){//Instantiate PrseetationEx class that represents the PPTXPresentationEx pres = new PresentationEx();SlideEx sld = pres.Slides[0];//Now create effect “PathFootball” for existing shape from scratch.int idx = sld.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 150, 150, 250, 25);AutoShapeEx ashp = (AutoShapeEx)sld.Shapes[idx];ashp.AddTextFrame(“Animated TextBox”);//Add PathFootBall animation effectShapeEx shape = pres.Slides[0].Shapes[idx];EffectEx eff = pres.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectTypeEx.Blinds,EffectSubtypeEx.None, EffectTriggerTypeEx.AfterPrevious);eff.PresetClassType = EffectPresetClassTypeEx.Exit;//Create some kind of “button”.int index = pres.Slides[0].Shapes.AddAutoShape(ShapeTypeEx.Bevel, 10, 10, 20, 20);ShapeEx shapeTrigger = pres.Slides[0].Shapes[index];//Create sequence of effects for this button.SequenceEx seqInter = pres.Slides[0].Timeline.InteractiveSequences.Add(shapeTrigger);//Create custom user path. Our object will be moved only after “button” click.EffectEx fxUserPath = seqInter.AddEffect(shape, EffectTypeEx.PathUser, EffectSubtypeEx.None, EffectTriggerTypeEx.OnClick);//Created path is empty so we should add commands for moving.MotionEffectEx motionBhv = ((MotionEffectEx)fxUserPath.Behaviors[0]);PointF[] pts = new PointF[1];pts[0] = new PointF(0.076f, 0.59f);motionBhv.Path.Add(MotionCommandPathTypeEx.LineTo, pts, MotionPathPointsTypeEx.Auto, true);pts[0] = new PointF(-0.076f, -0.59f);motionBhv.Path.Add(MotionCommandPathTypeEx.LineTo, pts, MotionPathPointsTypeEx.Auto, false);motionBhv.Path.Add(MotionCommandPathTypeEx.End, null, MotionPathPointsTypeEx.Auto, false);//Write the presentation as PPTX to diskpres.Write(“d:\AnimExample.pptx”);}