We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting Animations in Presentation using Aspose.Slides(C#)

Hi Aspose. I’m using the latest version of Aspose.Slides for .Net library and i cannot get the AnimationSettings property from the slide object like it’s described here. Could you please advise?

@obrusentsov,

Thanks for contacting us. I have shared sample code with you. This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

using (Presentation pres = new Presentation(path))
{
//Add a rectangle shape
IAutoShape rectangleShape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 500, 250);

//Add an ellipse shape
IAutoShape ellipseShape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Ellipse, 50, 300, 500, 250);

IAnimationTimeLine timeLine = pres.Slides[0].Timeline;
timeLine.MainSequence.Clear();

//Add effect to rectangle shape
IEffect rectangleEffect = timeLine.MainSequence.AddEffect(rectangleShape, EffectType.Fly, EffectSubtype.Left, EffectTriggerType.OnClick);
rectangleEffect.Timing.Duration = 2000;

//Add effect to rectangle shape
IEffect ellipseEffect = timeLine.MainSequence.AddEffect(rectangleShape, EffectType.Fly, EffectSubtype.Right, EffectTriggerType.OnClick);
ellipseEffect.Timing.Duration = 500;

// Get all shape effects
IEffect[] effects = timeLine.MainSequence.GetEffectsByShape(rectangleShape);
Console.WriteLine($""{rectangleShape.Name}" shape has {effects.Length} effect(s)");

pres.Save(outPath, SaveFormat.Pptx);
}

Thank you, i came to the same solution )

@obrusentsov,

You are very welcome.