Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active February 9, 2022 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/295bab13c921469e6d04b78223bf4704 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/295bab13c921469e6d04b78223bf4704 to your computer and use it in GitHub Desktop.
Apply Animation Effects to Text in PowerPoint PPT using Python
import aspose.slides as slides
# load presentation
with slides.Presentation("presentation.pptx") as presentation:
# select paragraph to add effect
autoShape = presentation.slides[0].shapes[0]
paragraph = autoShape.text_frame.paragraphs[0]
# add Fly animation effect to selected paragraph
effect = presentation.slides[0].timeline.main_sequence.add_effect(paragraph, slides.animation.EffectType.FLY, slides.animation.EffectSubtype.LEFT, slides.animation.EffectTriggerType.ON_CLICK)
# save presentation
presentation.save("AnimationEffectinParagraph.pptx", slides.export.SaveFormat.PPTX)
import aspose.slides as slides
# load presentation
with slides.Presentation("AnimationEffectinParagraph.pptx") as pres:
# get sequence
sequence = pres.slides[0].timeline.main_sequence
# access shape
autoShape = pres.slides[0].shapes[0]
# loop through paragraphs
for paragraph in autoShape.text_frame.paragraphs:
# get animation effects
effects = sequence.get_effects_by_paragraph(paragraph)
if len(effects) > 0:
print("Paragraph \"" + paragraph.text + "\" has " + str(effects[0].type) + " effect.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment