How to get the shape animation duration (C# .NET)


I can get some property from slide timelime, like animation type and delay, but the duration propery is always “NaN”.

to read the type I’m using:
EffectType et = shape.Slide.Timeline.MainSequence.GetEffectsByShape(shape)[0].Type

to read the delay:
float delay = shape.Slide.Timeline.MainSequence.GetEffectsByShape(shape)[0].Timing.TriggerDelayTime

When I try to get the Duration:
float duration = shape.Slide.Timeline.MainSequence.GetEffectsByShape(shape)[0].Timing.Duration

duration is NaN…

How I can read correctly the animation duration?


Hi Gabriele,

I have observed the requirement shared by you and request you to please share the sample presentation with us along with working sample code to reproduce the issue on our end. I will investigate the issue further on my end to help you out.

Many Thanks,

In this attached pptx we added:

- a text with effect type = “EffectType.Fly”, delay = 1 sec. and duration = 5 sec.
- an image with effect type = “EffectType.Wipe”, delay = 1 sec and duration 10 sec.


IEffect effect = shape.Slide.Timeline.MainSequence.GetEffectsByShape(shape)[0]

We can read effect.Type, effect.Timing.TriggerDelayTime, but effect.Duration is NaN.

Thanks in advance for your help!


Hi Gabriele,

Thanks for sharing the requested information.

I have worked with the presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-36240 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,


Please try using latest Aspose.Slides for .NET to get the animation duration. In the shared example, the first shape in TestAnimation.pptx presentation has one Fly effect with TriggerDelayTime = 1sec and NaN Duration.

This effect has three behaviors:

SetEffect with Duration = 0.001sec
PropertyEffect with Duration = 5sec
PropertyEffect with Duration = 5sec

The second shape has one Wipe effect with TriggerDelayTime = 1sec and NaN Duration.
And this effect has two behaviors:

SetEffect with Duration = 0.001sec
FilterEffect with Duration = 10sec

Presentation pres = new Presentation(path + "TestAnimation.pptx");
            ISlide slide = pres.Slides[0];

            foreach (Shape shape in slide.Shapes)
                if (shape.Slide.Timeline != null && shape.Slide.Timeline.MainSequence != null)
                    IEffect[] effects = slide.Timeline.MainSequence.GetEffectsByShape(shape);
                    //Iterating through all shape effects
                    foreach (IEffect effect in effects)
                        Console.WriteLine("Effect type: " + effect.Type);
                        Console.WriteLine("Effect delay time: " + effect.Timing.TriggerDelayTime);
                        Console.WriteLine("Effect duration: " + effect.Timing.Duration);

                        // Reading the effect behaviors
                        IBehaviorCollection behaviors = effect.Behaviors;
                        foreach (IBehavior behavior in behaviors)
                            Console.WriteLine(" Behavior type: " + behavior.GetType());
                            Console.WriteLine("  Behavior delay time: " + behavior.Timing.TriggerDelayTime);
                            Console.WriteLine("  Behavior duration: " + behavior.Timing.Duration);
            } (358.2 KB)