public class PresentationAnimationsGenerator
extends java.lang.Object
implements com.aspose.ms.System.IDisposable
Represents a generator of the animations in the Presentation.
Presentation pres = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(pres); try { PresentationPlayer player = new PresentationPlayer(animationsGenerator, 33); try { player.setFrameTick((sender, args) -> { try { ImageIO.write(args.getFrame(), "PNG", new java.io.File("frame_" + sender.getFrameIndex() + ".png")); } catch (IOException e) { throw new RuntimeException(e); } }); animationsGenerator.run(pres.getSlides()); } finally { if (player != null) player.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (pres != null) pres.dispose(); }
| Modifier and Type | Class and Description |
|---|---|
static interface |
PresentationAnimationsGenerator.NewAnimation
An event represents that a new animation was generated.
|
| Constructor and Description |
|---|
PresentationAnimationsGenerator(java.awt.Dimension frameSize)
Creates a new instance of the
PresentationAnimationsGenerator. |
PresentationAnimationsGenerator(java.awt.geom.Dimension2D frameSize)
Creates a new instance of the
PresentationAnimationsGenerator. |
PresentationAnimationsGenerator(Presentation presentation)
Creates a new instance of the
PresentationAnimationsGenerator. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes the instance of the
PresentationAnimationsGenerator. |
int |
getDefaultDelay()
Gets or sets default delay time [ms].
|
int |
getExportedSlides()
Get the number of the exported slides count.
|
java.awt.Dimension |
getFrameSize()
Gets the frame size.
|
boolean |
getIncludeHiddenSlides()
Get or sets if hidden slides should be included.
|
void |
run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides)
Run the animation events generation for each slide.
|
void |
run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides,
int fps,
PresentationPlayer.FrameTick onFrame)
Run the animation events generation for each slide.
|
void |
setDefaultDelay(int value)
Gets or sets default delay time [ms].
|
void |
setIncludeHiddenSlides(boolean value)
Get or sets if hidden slides should be included.
|
void |
setNewAnimation(PresentationAnimationsGenerator.NewAnimation anim)
Set a new animation event.
|
public PresentationAnimationsGenerator(Presentation presentation)
Creates a new instance of the PresentationAnimationsGenerator.
presentation - The frame size will be set with accordance to the Presentation.getSlideSize()public PresentationAnimationsGenerator(java.awt.Dimension frameSize)
Creates a new instance of the PresentationAnimationsGenerator.
frameSize - The frame size.public PresentationAnimationsGenerator(java.awt.geom.Dimension2D frameSize)
Creates a new instance of the PresentationAnimationsGenerator.
frameSize - The frame size.public final void dispose()
Disposes the instance of the PresentationAnimationsGenerator.
dispose in interface com.aspose.ms.System.IDisposablepublic java.awt.Dimension getFrameSize()
Gets the frame size.
public final int getDefaultDelay()
Gets or sets default delay time [ms].
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setDefaultDelay(1000); // 1s // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final void setDefaultDelay(int value)
Gets or sets default delay time [ms].
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setDefaultDelay(1000); // 1s // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final boolean getIncludeHiddenSlides()
Get or sets if hidden slides should be included.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setIncludeHiddenSlides(false); // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final void setIncludeHiddenSlides(boolean value)
Get or sets if hidden slides should be included.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setIncludeHiddenSlides(false); // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final int getExportedSlides()
Get the number of the exported slides count.
public void setNewAnimation(PresentationAnimationsGenerator.NewAnimation anim)
Set a new animation event.
Presentation presentation = new Presentation("SimpleAnimations.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setNewAnimation(animationPlayer -> { System.out.println(String.format("Animation total duration: %f", animationPlayer.getDuration())); }); animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
anim - Animation event.public final void run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides)
Run the animation events generation for each slide.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { PresentationPlayer player = new PresentationPlayer(animationsGenerator, 33); try { animationsGenerator.setNewAnimation(animationPlayer -> { // handle new animation }); player.setFrameTick((sender, args) -> { // handle frame tick within the new animation }); animationsGenerator.run(presentation.getSlides()); } finally { if (player != null) player.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final void run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides, int fps, PresentationPlayer.FrameTick onFrame)
Run the animation events generation for each slide.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.run(presentation.getSlides(), 33, (player, playerArgs) -> { player.setFrameTick((sender, args) -> { try { ImageIO.write(args.getFrame(), "PNG", new java.io.File("frame_" + sender.getFrameIndex() + ".png")); } catch (IOException e) { throw new RuntimeException(e); } }); }); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.