PPTX

Animations

Add entrance, exit, emphasis, and motion path animations to shapes

Add animation effects to shapes to control how they appear and behave during a presentation.

Basic Usage

Animations live at the slide level, not on shapes — CT_Shape has no timing child in the XSD. Each slide exposes an animations array whose entries pair a shapeId (the target shape's cNvPr id) with an options object:

import { generatePresentation } from "@office-open/pptx";
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "id": 2,
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "15.9cm",
            "height": "6.6cm",
            "textBody": { "text": "Animated shape" }
          }
        }
      ],
      "animations": [{ "shapeId": 2, "options": { "type": "fade", "duration": 800 } }]
    }
  ]
}

Each animations entry is a { shapeId, options } pair. The shapeId matches the id set on the target shape's NonVisualDrawingProperties (the cNvPr id), which you assign via shape.id. The options object carries the animation preset — the same fields documented in the type-specific sections below.

Animation Types

Entrance Animations (class: "entr", default)

TypeDescriptionSupported Directions
appearInstantly appear
fadeFade in
flyFly in from edgeleft, right, up, down
wipeWipe in from edgeleft, right, up, down
dissolveDissolve in
splitSplit inhorizontal, vertical
blindsBlinds effecthorizontal, vertical
checkerCheckerboardhorizontal, vertical
randomBarsRandom barshorizontal, vertical
wheelWheel spokes
zoomZoom in
coverCover from edgeleft, right, up, down
pushPush from edgeleft, right, up, down
stripsStrips from cornerleft, right, up, down

Exit Animations (class: "exit")

Same types as entrance, but with class: "exit":

// entry in slide.animations[]:
{ shapeId, options: { type: "fade", class: "exit", duration: 800 } }
{ shapeId, options: { type: "fly", class: "exit", direction: "right" } }

Emphasis Animations (class: "emph")

emphasisTypeDescription
growShrinkScale up then back
spinFull rotation
colorChangeChange color (requires color)
transparencyFade to semi-transparent
boldFlashBold text flash
waveWave effect
pulsePulse effect
growWithTurnGrow with rotation
{ shapeId, options: { class: "emph", emphasisType: "growShrink", duration: 800 } }
{ shapeId, options: { class: "emph", emphasisType: "spin", duration: 1000 } }
{ shapeId, options: { class: "emph", emphasisType: "colorChange", color: "FF0000" } }

Motion Path Animations

pathTypeDescription
lineStraight line
arcArc curve
circleCircular path
curveS-curve
figureEightFigure-eight
bounceBounce path
loopLoop path
customPathCustom SVG path (requires path)
{ shapeId, options: { pathType: "circle", duration: 1500 } }
{ shapeId, options: { pathType: "customPath", path: "M 0 0 L 100 0 L 100 100 L 0 100 Z", duration: 1200 } }

Media Playback (class: "mediacall")

Trigger audio/video playback on a media shape (a { video } / { audio } child) with mediaType. The shapeId must point at the media frame:

{ shapeId, options: { class: "mediacall", mediaType: "playVideo", fullScreen: true, showWhenStopped: true } }
{ shapeId, options: { class: "mediacall", mediaType: "playAudio", volume: 80, mute: false } }
PropertyTypeDescription
mediaType"playAudio" | "playVideo" | "play"Media animation type
isNarrationbooleanMedia is a narration track
fullScreenbooleanPlay video full-screen
volumenumberVolume level
mutebooleanMute audio
showWhenStoppedbooleanKeep the media frame visible when stopped

Animation Options

PropertyTypeDefaultDescription
typeAnimationType"appear"Animation preset type
class"entr" | "exit" | "emph" | "mediacall""entr"Animation category
durationnumber500Duration in milliseconds
delaynumber0Delay before start in milliseconds
triggerAnimationTrigger"onClick"How animation is triggered
directionAnimationDirectionDirection of the animation
emphasisTypeEmphasisTypeEmphasis animation type (class="emph")
pathTypePathAnimationTypeMotion path type
pathstringCustom SVG path string
speednumberSpeed multiplier
repeatCountnumberNumber of repetitions
autoReversebooleanfalseAuto-reverse after completion
colorstringTarget color for colorChange
pathEditMode"relative" | "fixed" | "none"Motion path edit mode
rotationAnglenumberMotion path rotation in 1/60000ths of a degree (p:animRot @rAng; passed through raw)
motionFrom{ x: string; y: string }Motion path start point
motionRotationCenter{ x: string; y: string }Motion rotation center
zoomContentsbooleanfalseZoom contents during a scale animation

Trigger Modes

{ shapeId, options: { type: "fade", trigger: "onClick" } }
{ shapeId, options: { type: "fade", trigger: "withPrevious" } }
{ shapeId, options: { type: "fade", trigger: "afterPrevious" } }
Copyright © 2026