IPresentationAnimationPlayer

public interface IPresentationAnimationPlayer

Represents a player of the animation.


Presentation presentation = new Presentation("animated.pptx");
 try {
     PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize());
     {
         animationsGenerator.setNewAnimation(animationPlayer -> {
             System.out.println(String.format("Animation total duration: %f", animationPlayer.getDuration()));
             animationPlayer.setTimePosition(0);
             try {
                 ImageIO.write(animationPlayer.getFrame(), "PNG", new java.io.File("firstFrame.png"));
             } catch (IOException e) {
                 throw new RuntimeException(e);
             }
             animationPlayer.setTimePosition(animationPlayer.getDuration());
             try {
                 ImageIO.write(animationPlayer.getFrame(), "PNG", new java.io.File("lastFrame.png"));
             } catch (IOException e) {
                 throw new RuntimeException(e);
             }
         });
         animationsGenerator.run(presentation.getSlides());
     }
 } finally {
     if (presentation != null) presentation.dispose();
 }

Animations generated by PresentationAnimationsGenerator via its PresentationAnimationsGenerator.NewAnimation event.

Methods

MethodDescription
getDuration()Get animation duration [ms]
setTimePosition(double time)Set the animation time position within the Duration (#getDuration.getDuration).
getFrame()Get the frame for the current time position previously set with the #setTimePosition(double).setTimePosition(double) method.

getDuration()

public abstract double getDuration()

Get animation duration [ms]

Returns: double

setTimePosition(double time)

public abstract void setTimePosition(double time)

Set the animation time position within the Duration (#getDuration.getDuration).

Parameters:

ParameterTypeDescription
timedoubleTime position.

getFrame()

public abstract BufferedImage getFrame()

Get the frame for the current time position previously set with the #setTimePosition(double).setTimePosition(double) method.

Returns: java.awt.image.BufferedImage - Frame image