Shape animation in slides

The .Net documentation has an article on

Applying Animations on Shapes inside Slide

I am looking for a similar article for Java could you please advise on where I could find this.

Thanks

Hi Stephen,

I have observed the requirements shared by you and have created the java sample code for your convenience. I hope this will be helpful. Please share, if I may help you further in this regard.

Presentation pres = new Presentation();

ISlide sld = pres.getSlides().get_Item(0);

//Now create effect “PathFootball” for existing shape from scratch.
IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 150, 250, 25);

ashp.addTextFrame(“Animated TextBox”);

//Add PathFootBall animation effect
pres.getSlides().get_Item(0).getTimeline().getMainSequence().
addEffect(ashp, EffectType.PathFootball,
EffectSubtype.None, EffectTriggerType.AfterPrevious);

//Create some kind of “button”.
IShape shapeTrigger = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Bevel, 10, 10, 20, 20);

//Create sequence of effects for this button.
ISequence seqInter = pres.getSlides().get_Item(0).getTimeline().getInteractiveSequences().add(shapeTrigger);

//Create custom user path. Our object will be moved only after “button” click.
IEffect fxUserPath = seqInter.addEffect(ashp, EffectType.PathUser, EffectSubtype.None, EffectTriggerType.OnClick);

//Created path is empty so we should add commands for moving.
IMotionEffect motionBhv = ((IMotionEffect)fxUserPath.getBehaviors().get_Item(0));

Point2D.Float[] pts=new Point2D.Float[1];;
pts[0]=new Point2D.Float(0.076f, 0.59f);
motionBhv.getPath().add(MotionCommandPathType.LineTo, pts, MotionPathPointsType.Auto, true);

pts[0]=new Point2D.Float(-0.076f, -0.59f);
motionBhv.getPath().add(MotionCommandPathType.LineTo, pts, MotionPathPointsType.Auto, false);
motionBhv.getPath().add(MotionCommandPathType.End, null, MotionPathPointsType.Auto, false);

//Write the presentation as PPTX to disk
pres.save(“AnimExample.pptx”, SaveFormat.Pptx);


Many Thanks,
1 Like