MS PowerPoint provides various animation effects which are used to make the presentations interesting and draw the attention of the viewers. These animations can be applied to slides, text, shapes, or other elements. In this article, we will focus on animating text in a PowerPoint PPT. Particularly, you will learn how to apply and retrieve text animation programmatically in Python.
- Python Library to Apply Animation to Text in PowerPoint
- Apply Animation to Text in PowerPoint
- Get Animation Effects from a Text in PowerPoint
Python Library to Apply Animation to Text in PPT
To apply animation to the text in PowerPoint presentations, we will use Aspose.Slides for Python via .NET. It is a feature-rich library that is designed to create and manipulate PPT and PPTX presentations. Use the following pip command to install the library from PyPI.
> pip install aspose.slides
Apply Animation to Text in PowerPoint PPT in Python
There are over 150 animation effects that Aspose.Slides for Python supports, such as Bounce, PathFootball, Zoom, etc. In addition, you can also use specific animation effects such as OLEObjectShow and OLEObjectOpen. You can view the complete list of animations in EffectType enumeration.
The following are the steps to apply animation to text in a PowerPoint PPT using Python.
- First, load the PPT/PPTX file using Presentation class.
- Then, get reference of the paragraph to which you want to apply animation.
- Apply animation effect using Presentation.slides[index].timeline.main_sequence.add_effect() method.
- Finally, save the presentation using Presentation.save(string, SaveFormat) method.
The following code sample shows how to apply an animation effect to text in a PowerPoint PPT.
Get Animation Effects from a Text in PowerPoint
There could be the case when you need to replicate the animation from one text to another. In that case, you can get information about the animation effect applied to a particular text.
The following are the steps to get information about the animation effect applied to a text in Python.
- First, load the presentation using Presentation class.
- Then, get sequence of the desired slide in an object.
- Access the desired shape from the slide in an object.
- Loop through each paragraph in shape.text_frame.paragraph collection.
- Finally, get the effects using sequence.get_effects_by_paragraph() method.
The following code sample shows how to get the information of an animation effect in PPT.
Get a Free API License
You can use Aspose.Slides for Python via .NET without evaluation limitations by getting a temporary license.
In this article, you have learned how to apply animation effects on text in PowerPoint PPT using Python. Furthermore, you have seen how to get animation effects from a particular text in a PPT/PPTX. Besides, you can explore other features of Aspose.Slides for Python using documentation. Moreover, you can feel free to let us know about your queries via our forum.