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

Free Support Forum - aspose.com

Accessing AnimationSettings on a shape (C# .NET)

I just installed the latest demo version and in ShapeEx the annimation setting are set to being internal;
protected internal AnimationSettings m_animationSettings;
How can I read the animation settings for a shape?

Dear Richard,

Please proceed to this documentation link for code snippet to apply animations on the shapes. Please share with us if the problem still persists.

Thanks and Regards,

In VBA you can do the following;

With objShape.AnimationSettings
.EntryEffect = ppEffectNone
.Animate = msoTrue
.AnimationOrder = 3
End With

How can I get or set the AnimationOrder for the shape using Aspose.Slides?

Dear Richard,

Please use the following code snippet for setting the animation order for the shape inside slide. For further information, please proceed to this link.

shape.AnimationSettings.AnimationOrder = 1;

Thanks and Regards,

Am I missing something? Is this available on a ShapeEx?

Hello Dear,

Please follow this documentation link for applying animations on PPTX shapes. Please share with us, if you have any further issue.

Thanks and Regards,

You have already sent me that link and it doesnt answer the question.

How can I get or set the AnimationOrder on an existing ShapeEx animation effect?

Hello Dear,

Actually, Sequence.AddEffect() method adds the animation at the end of the sequence. Unlike in PPT, you may not add the sequence order in PPTX. The order, in which you will add shapes in sequence list the same order will be preserved for animations. The following line adds the animation to sequence. Please proceed to this documentation link for further details.

pres.Slides[0].Timeline.MainSequence.AddEffect(shape,AnimEffectTypeEx.PathFootball, AnimEffectSubtypeEx.None, AnimEffectTriggerTypeEx.AfterPrevious);

Thanks and Regards,

You are missing my question. The effects are already added to the shape, I need to reorder them.
I’ve attached a PPTX to show you. On the 1st slide there are two shapes with custom animation effects.
To change the animation order I can use VBA;


ActivePresentation.Slides(1).Shapes(1).AnimationSettings.AnimationOrder=1

ActivePresentation.Slides(1).Shapes(2).AnimationSettings.AnimationOrder=2


or the following to reverse the order;


ActivePresentation.Slides(1).Shapes(2).AnimationSettings.AnimationOrder=1

ActivePresentation.Slides(1).Shapes(1).AnimationSettings.AnimationOrder=2

How can I do this using the Aspose ShapeEx object to edit the animation order in this PPTX?


Hello Dear,

I am sorry for the delayed response as I am awaiting response from our development team. In may humble opinion, I don't feel that option for setting animation order is available in PPTX. The order they are first entered in animation sequence, that is followed for animation. I have requested our development team to share any possible mechanism to alter the animation order. As soon as some response is shared, I will be really obliged to share that with you.

Best Regards,

Thank you, I’ll await your responce. But you are wrong, it is possible. I’ve attached a screen cast showing the animation order being changed with VBA on a file called test.pptx. Initially the triangle moved followed by the circle. After executing the following VBA the circle moves first;
ActivePresentation.Slides(1).Shapes(1).AnimationSettings.AnimationOrder=2
Regards

Hello Dear,

I am in consultation consultation our development team and as soon as some response is shared, I will be glad to share that with you. I appreciate your patience for this.

Thanks and Regards,

@r10n,

Now you can use the following example code and source presentation to get animation duration using latest Aspose.Slides for .NET 20.6.

In the shared example, I have added the sample presentation with different animation effects on shapes. 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)