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

Free Support Forum - aspose.com

Animation starting time and duration information (C# .NET)

Hi,

Is there any way to get animation strarting time and duration information in a powerpoint slide?

I am able to get only animation transition time.

How can I get animation strarting time and duration?

Dear Hwanmo,

I regret to share that unfortunately it is not possible to get the animation starting time since the animation starting depends on trigger event. However you may get the starting time of animation from last event using AnimationSettings.AdvanceTime property. Similarly, the animation duration time property is also unavailable.

We are sorry for your inconvenience,

@hwanmo,

Using latest Aspose.Slides for .NET 20.6, you can use the following example code and source presentation to get 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);
                        }
                    }
                }
            }

TestAnimation.zip (358.2 KB)