Wednesday, 25 March 2020 08:28

How to Repeat an Animation in PowerPoint in Java

Written by  support iceblue
Rate this item
(0 votes)

By default, an animation plays only one time and does not repeat. However, we can make the animation to play more than once by setting the repeat type of it. This article demonstrates how to accomplish this function using Spire.Presentation for Java.

import com.spire.presentation.*;
import com.spire.presentation.drawing.animation.AnimationEffect;

public class RepeatAnimation {
    public static void main(String[] args) throws Exception {
        //Create a Presentation instance
        Presentation ppt = new Presentation();
        //Load a PowerPoint document
        //Get the first slide
        ISlide slide = ppt.getSlides().get(0);
        //Get the first animation effect on the slide
        AnimationEffect animation = slide.getTimeline().getMainSequence().get(0);
        //Set the animation effect to repeat forever until the end of slide.

        //Save the result document
        ppt.saveToFile("RepeatAnimation.pptx", FileFormat.PPTX_2013);


How to Repeat an Animation in PowerPoint in Java

Additional Info

  • tutorial_title: Repeat an Animation in PowerPoint in Java