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(new PresentationAnimationsGenerator.NewAnimation() {
             public void invoke(IPresentationAnimationPlayer animationPlayer) {
                 System.out.println(String.format("Animation total duration: %f", animationPlayer.getDuration()));
                 animationPlayer.setTimePosition(0);
                 FileOutputStream fosFirst = null;
                 try {
                     fosFirst = new FileOutputStream("firstFrame.png");
                     animationPlayer.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fosFirst);
                 } catch (IOException e) {
                     throw new RuntimeException(e);
                 } finally {
                     if (fosFirst != null) {
                         try {
                             fosFirst.close();
                         } catch (IOException e) {
                             e.printStackTrace();
                         }
                     }
                 }
                 animationPlayer.setTimePosition(animationPlayer.getDuration());
                 FileOutputStream fosLast = null;
                 try {
                     fosLast = new FileOutputStream("lastFrame.png");
                     animationPlayer.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fosLast);
                 } catch (IOException e) {
                     throw new RuntimeException(e);
                 } finally {
                     if (fosLast != null) {
                         try {
                             fosLast.close();
                         } catch (IOException e) {
                             e.printStackTrace();
                         }
                     }
                 }
             }
         });
         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 Bitmap getFrame()

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

Returns: android.graphics.Bitmap - Frame image