PPTX

切换效果

添加淡入、推入、擦除等幻灯片切换效果

使用幻灯片选项中的 transition 属性在切换幻灯片时添加动画效果。

基本切换

{
  "slides": [
    {
      "children": [],
      "transition": { "type": "fade", "speed": "med" }
    }
  ]
}

幻灯片放映设置

使用 show 选项控制演示文稿播放行为:

{
  "show": {
    "loop": true,
    "useTimings": true
  },
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "0.0cm",
            "y": "0.0cm",
            "width": "5.3cm",
            "height": "2.6cm",
            "textBody": { "text": "幻灯片 1" }
          }
        }
      ]
    }
  ]
}

放映选项

属性类型说明
loopboolean循环放映
type"present" | "browse" | "kiosk"放映类型(演讲/浏览/展台)
showScrollbarboolean显示滚动条(浏览模式)
restartnumber重启策略
showNarrationboolean放映时播放旁白
showAnimationboolean放映时显示动画
useTimingsboolean使用录制的排练时间
slideRange{ start: number; end: number }限定放映的幻灯片范围
penColorstring演示笔颜色(srgbClr hex)

切换类型

淡入

transition: {
  type: "fade";
}

推入

transition: { type: "push", direction: "right" }
// direction: "left"(左) | "right"(右) | "up"(上) | "down"(下)

擦除

transition: { type: "wipe", direction: "down" }

覆盖

transition: { type: "cover", direction: "right" }

拆分

transition: { type: "split", orient: "horz", direction: "out" }
// orient: "horz" | "vert"
// direction: "in" | "out"

轮辐

transition: { type: "wheel", spokes: 4 }

溶解

transition: { type: "dissolve", speed: "slow" }

随机

transition: {
  type: "random";
}

切换选项

属性类型说明
typeTransitionType切换类型
speed"slow" | "med" | "fast"切换速度
directionstring方向(取决于类型)
orient"horz" | "vert"方向(拆分/百叶窗/棋盘等)
spokesnumber轮辐数量(轮辐切换)
advanceOnClickboolean单击鼠标时切换
advanceAfterTimenumber自动切换间隔(毫秒)
thruBlkboolean黑场过渡(淡入/剪切)
startSound{ rId; name?; loop? }切换开始时播放的声音
stopPreviousSoundboolean停止之前播放的声音

可用类型

"fade" | "push" | "wipe" | "split" | "blinds" | "checker" | "comb" | "randomBar" | "cover" | "pull" | "strips" | "wheel" | "zoom" | "circle" | "dissolve" | "diamond" | "newsflash" | "plus" | "wedge" | "random" | "cut"

完整示例

{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "2.6cm",
            "y": "4.0cm",
            "width": "13.2cm",
            "height": "2.6cm",
            "textBody": { "text": "Welcome" },
            "fill": "4472C4"
          }
        }
      ],
      "transition": { "type": "fade", "speed": "med" }
    },
    {
      "children": [
        {
          "shape": {
            "x": "2.6cm",
            "y": "4.0cm",
            "width": "13.2cm",
            "height": "2.6cm",
            "textBody": { "text": "Content Slide" },
            "fill": "ED7D31"
          }
        }
      ],
      "transition": { "type": "push", "direction": "right", "speed": "slow" }
    },
    {
      "children": [
        {
          "shape": {
            "x": "2.6cm",
            "y": "4.0cm",
            "width": "13.2cm",
            "height": "2.6cm",
            "textBody": { "text": "Thank You" },
            "fill": "70AD47"
          }
        }
      ],
      "transition": { "type": "wipe", "direction": "down" }
    }
  ]
}
Copyright © 2026