亚洲精品久久久久久第一页-人妻少妇精彩视品一区二区三区-91国产自拍免费视频-免费一级a在线播放视频正片-少妇天天日天天射天天爽-国产大屁股喷水视频在线观看-操美女骚穴抽插性爱视频-亚洲 欧美 中文字幕 丝袜-成人免费无码片在线观看

ppt動畫動作路徑設(shè)置 Java 自定義PPT動畫動作路徑

關(guān)于文檔路徑:本次測試環(huán)境中為方便文檔管理,將文檔放在IDEA項(xiàng)目文件夾下(這里的文件路徑可以另外自定義) 。如下圖:

ppt動畫動作路徑設(shè)置 Java 自定義PPT動畫動作路徑

文章插圖
在IDEA程序中引入spire.presentation.jar工具,如下圖
ppt動畫動作路徑設(shè)置 Java 自定義PPT動畫動作路徑

文章插圖
在程序中鍵入如下代碼內(nèi)容:
import com.spire.presentation.*;
import com.spire.presentation.collections.CommonBehaviorCollection;
import com.spire.presentation.drawing.FillFormatType;
import com.spire.presentation.drawing.animation.*;

import java.awt.*;
import java.awt.geom.Point2D;


public class CustomAnimationPath {
public static void main(String[] args) throws Exception {
//創(chuàng)建一個空白PPT文檔
Presentation ppt = new Presentation();

//獲取第一張幻燈片(新建的幻燈片文檔默認(rèn)已包含一張幻燈片)
ISlide slide = ppt.getSlides().get(0);

//添加形狀到幻燈片
IAutoShape shape = slide.getShapes().appendShape(ShapeType.FIVE_POINTED_STAR,new Rectangle(180, 100, 170, 170));
shape.getFill().setFillType(FillFormatType.GRADIENT);
shape.getFill().getGradient().getGradientStops().append(0, KnownColors.LIGHT_PINK);
shape.getFill().getGradient().getGradientStops().append(1, KnownColors.PURPLE);
shape.getShapeStyle().getLineColor().setColor(Color.white);

//添加動畫效果,并設(shè)置動畫效果類型為PATH_USER(自定義類型)
AnimationEffect effect = slide.getTimeline().getMainSequence().addEffect(shape, AnimationEffectType.PATH_USER);

//獲取自定動畫的CommonBehavior集合
CommonBehaviorCollection commonBehaviorCollection = effect.getCommonBehaviorCollection();

//設(shè)置動畫動作運(yùn)動起點(diǎn)及路徑模式
AnimationMotion motion = (AnimationMotion)commonBehaviorCollection.get(0);
motion.setOrigin(AnimationMotionOrigin.LAYOUT);
motion.setPathEditMode(AnimationMotionPathEditMode.RELATIVE);
//設(shè)置動作路徑
MotionPath motionPath = new MotionPath();
motionPath.addPathPoints(MotionCommandPathType.MOVE_TO,new Point2D.Float[]{new Point2D.Float(0,0)},MotionPathPointsType.CURVE_AUTO,true);
motionPath.addPathPoints(MotionCommandPathType.LINE_TO,new Point2D.Float[]{new Point2D.Float(0.1f,0.1f)},MotionPathPointsType.CURVE_AUTO,true);
motionPath.addPathPoints(MotionCommandPathType.LINE_TO,new Point2D.Float[]{new Point2D.Float(-0.1f,0.2f)},MotionPathPointsType.CURVE_AUTO,true);
motionPath.addPathPoints(MotionCommandPathType.END,new Point2D.Float[]{},MotionPathPointsType.CURVE_AUTO,true);
//設(shè)置動作路徑到動畫
motion.setPath(motionPath);

//保存文檔
ppt.saveToFile("result.pptx", FileFormat.PPTX_2013);
ppt.dispose();
}
}
完成代碼后,執(zhí)行程序,生成文檔(如上圖1中,文檔路徑),打開文檔后,可查看自定義動畫路徑效果:
ppt動畫動作路徑設(shè)置 Java 自定義PPT動畫動作路徑

文章插圖


    以上關(guān)于本文的內(nèi)容,僅作參考!溫馨提示:如遇健康、疾病相關(guān)的問題,請您及時就醫(yī)或請專業(yè)人士給予相關(guān)指導(dǎo)!

    「愛刨根生活網(wǎng)」www.malaban59.cn小編還為您精選了以下內(nèi)容,希望對您有所幫助: