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
ppt.loadFromFile("Animation.pptx");
//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.
animation.getTiming().setAnimationRepeatType(AnimationRepeatType.UtilEndOfSlide);
//Save the result document
ppt.saveToFile("RepeatAnimation.pptx", FileFormat.PPTX_2013);
}
}
Output:

