We have already introduced how to add animation effect to shape in PowerPoint, in this article, we will introduce how to add animation effect to paragraph in PowerPoint using Spire.Presentation for Java.
import com.spire.presentation.*; import com.spire.presentation.drawing.FillFormatType; import com.spire.presentation.drawing.animation.*; import java.awt.*; import java.awt.geom.Rectangle2D; public class AddAnimationOnParagraph { public static void main(String[] args) throws Exception { //Create a Presentation instance Presentation ppt = new Presentation(); //Get the first slide ISlide slide = ppt.getSlides().get(0); //Add a shape to the slide IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, new Rectangle2D.Double(150, 150, 450, 100)); shape.getFill().setFillType(FillFormatType.SOLID); shape.getFill().getSolidColor().setColor(Color.gray); shape.getShapeStyle().getLineColor().setColor(Color.white); shape.appendTextFrame("This demo shows how to apply animation on paragraph in PPT document."); //Add animation effect to the first paragraph in the shape AnimationEffect animation = shape.getSlide().getTimeline().getMainSequence().addEffect(shape, AnimationEffectType.FLOAT); animation.setStartEndParagraphs(0, 0); //Save the result document ppt.saveToFile("AddAnimationOnPara.pptx", FileFormat.PPTX_2013); ppt.dispose(); } }
Output: