How to Create Custom Animations and Morph Transitions in PowerPoint with OfficeCLI

OfficeCLI enables you to programmatically generate PowerPoint presentations with smooth morph transitions and custom animations by orchestrating Open XML shape properties across slides using prefixed naming conventions and automated ghosting rules. This cross-platform command-line tool exposes Microsoft Office document schemas through verbs like create, add, set, and validate, allowing you to build complex animated decks without opening PowerPoint manually.

The repository implements a modular skill system where the base officecli-pptx handler manages standard PowerPoint operations, while the specialized morph-ppt skill adds the orchestration layer required for morph transitions—PowerPoint’s continuous interpolation of shape properties between adjacent slides.

Understanding the OfficeCLI Architecture for PowerPoint Animation

Before creating animations, you must understand how OfficeCLI structures its document manipulation pipeline. The architecture separates concerns across distinct layers to ensure type-safe operations and automated validation.

Core Handler Structure

The PowerPoint handler (src/officecli/Handlers/PowerPointHandler.cs and its partial classes in src/officecli/Handlers/Pptx/PowerPointHandler.*.cs) implements the IDocumentHandler interface, providing methods to add slides, shapes, charts, and transitions. This handler bridges the CLI front-end (src/officecli/Program.cs) with the underlying Open XML manipulation.

The Morph Skill Extension

According to skills/morph-ppt/SKILL.md, the morph skill sits atop the base PPTX rules and introduces shape-name binding—the critical mechanism that enables PowerPoint to match shapes across slides. The skill automatically prefixes morph-compatible shape names with !! and enforces three namespace conventions:

  • !!scene-* – Persistent background actors that remain visible across multiple slides
  • !!actor-* – Foreground elements that animate in and eventually exit the choreography
  • #sN-* – Per-slide content (where N is the slide number) that must be ghosted when advancing

The Morph Transition System

Morph transitions rely on identical shape names across consecutive slides. When PowerPoint detects two shapes sharing the same name on adjacent slides with transition=morph enabled, it calculates interpolated frames for position, size, rotation, color, and other visual attributes.

Ghost Discipline and the 36cm Rule

To prevent shape accumulation (known as M-2 ghost accumulation), any actor that should disappear must be moved to x=36cm on every subsequent slide. This off-canvas placement effectively removes the shape from view while maintaining the name binding required for the morph algorithm. The helper script skills/morph-ppt/reference/morph-helpers.py automates this cleanup.

Spatial Variety Requirements

The morph skill enforces a spatial variety rule to avoid static fades: at least three !!-prefixed shapes must change position by ≥5cm or rotation by ≥15° between slide pairs. This ensures the transition renders as dynamic motion rather than a simple cross-fade.

Step-by-Step: Creating Your First Morph Animation

The following workflow demonstrates how to create a basic "hero headline" morph where text shrinks and repositions smoothly between slides.

1. Initialize the Deck

FILE="hero.pptx"
officecli create "$FILE"

2. Build the Opening Slide


# Slide 1 – large centered headline

officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761
officecli add "$FILE" /slide[1] --type shape \
  --prop 'name=!!actor-headline' \
  --prop text="The One Idea" \
  --prop x=4cm --prop y=8cm --prop width=26cm --prop height=3cm \
  --prop font=Georgia --prop size=48 --prop bold=true --prop color=FFFFFF --prop align=center

3. Create the Morph Target


# Slide 2 – transition enabled, headline shrinks and moves

officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761 --prop transition=morph
officecli add "$FILE" /slide[2] --type shape \
  --prop 'name=!!actor-headline' \
  --prop text=" The One Idea" \
  --prop x=1.5cm --prop y=1cm --prop width=12cm --prop height=1.5cm \
  --prop font=Georgia --prop size=24 --prop bold=true --prop color=FFFFFF --prop align=left

Notice the identical name=!!actor-headline property—this binding triggers the interpolation.

Advanced Morph Techniques

Multi-Shape Coordinated Movement

For complex scenes with background elements, use the !!scene-* prefix to create persistent environmental actors that glide independently of foreground content:

FILE="scene.pptx"
officecli create "$FILE"

# Slide 1 – base composition with scene actors

officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761
officecli add "$FILE" /slide[1] --type shape --prop 'name=!!scene-ring' --prop preset=ellipse \
  --prop fill=E94560 --prop opacity=0.3 --prop x=5cm --prop y=3cm --prop width=8cm --prop height=8cm

# Slide 2 – morph with spatial variety

officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761 --prop transition=morph
officecli add "$FILE" /slide[2] --type shape --prop 'name=!!scene-ring' \
  --prop fill=E94560 --prop opacity=0.6 --prop x=20cm --prop y=2cm --prop width=12cm --prop height=12cm

Automating Multi-Slide Decks with Python Helpers

For presentations requiring five or more morph steps, use the morph-helpers.py reference implementation to enforce ghost discipline automatically:

#!/usr/bin/env bash
FILE="arc.pptx"
officecli create "$FILE"

HELPERS="skills/morph-ppt/reference/morph-helpers.py"

# Build slides 2-5 automatically

for n in {2..5}; do
    python "$HELPERS" clone "$FILE" $((n-1)) $n
    python "$HELPERS" ghost "$FILE" $n 1 2
    
    officecli add "$FILE" "/slide[$n]" --type shape \
      --prop 'name=#s'"$n"'-body' \
      --prop text="Slide $n content" \
      --prop x=1.5cm --prop y=5cm --prop width=30cm --prop height=2cm
done

python "$HELPERS" final-check "$FILE"

The clone command duplicates the previous slide structure while setting transition=morph. The ghost command moves specified shape indices to x=36cm, and final-check validates against Gate M-2 (ghost accumulation).

Validating and Delivering Production-Ready Decks

OfficeCLI implements delivery gates—automated checks that enforce visual, structural, and runtime correctness before a deck is shipped.

Running Validation

officecli validate deck.pptx

This executes the base PPTX gates (1-5a) plus morph-specific gates (5b-1 through 5b-4). If Gate 5b-1 detects an actor leak (a shape that should have been ghosted), the CLI outputs the specific violation and the XPath to the offending element, allowing you to fix it with:

officecli set "$FILE" "/slide[2]/shape[@name=#s1-title]" --prop x=36cm

Renderer Compatibility Notes

Morph transitions require PowerPoint 365, Keynote, or WPS Office. Viewers like LibreOffice Impress or Google Slides will display a static fade instead of smooth interpolation—this is a renderer limitation documented in skills/officecli-pptx/SKILL.md, not a bug in the generated markup.

Summary

  • Shape-name binding using !! prefixes enables PowerPoint to interpolate shape properties across slides with transition=morph set.
  • Ghost discipline requires moving departed actors to x=36cm to prevent visual accumulation and satisfy Gate M-2 validation.
  • Spatial variety rules mandate that at least three shapes change position (≥5cm) or rotation (≥15°) to avoid static fade effects.
  • Helper scripts in skills/morph-ppt/reference/morph-helpers.py automate cloning, ghosting, and accumulation cleanup for multi-slide decks.
  • Delivery gates (1-5a and 5b series) enforce production quality through automated structural validation before shipping.

Frequently Asked Questions

What is the difference between scene actors and regular actors in OfficeCLI morph decks?

Scene actors (prefixed with !!scene-*) are persistent background elements that remain visible across multiple slides and typically perform environmental animations, while regular actors (prefixed with !!actor-*) are foreground elements that enter, animate, and eventually exit the slide sequence. Both require identical names across slides to trigger morph interpolation, but scene actors are never ghosted (moved to x=36cm), whereas regular actors must be ghosted after their final appearance.

Why do shapes need to be moved to x=36cm instead of being deleted?

Moving shapes to x=36cm maintains the name binding required by PowerPoint's morph algorithm while removing the element from the visible canvas. If you delete the shape entirely, PowerPoint cannot find a matching target on the subsequent slide, breaking the interpolation chain. This ghost discipline prevents the M-2 ghost accumulation error flagged during validation.

How does the spatial variety rule prevent morph animation failures?

The spatial variety rule (enforced in Gate 5b-1) requires at least three !!-prefixed shapes to change position by 5cm or rotation by 15° between slides. Without sufficient visual change, PowerPoint may render the transition as a simple cross-fade rather than smooth motion, which the skill system treats as a quality failure. This ensures your custom animations demonstrate meaningful movement.

Can I view OfficeCLI morph transitions in LibreOffice or Google Slides?

No. Morph transitions rely on PowerPoint's proprietary interpolation engine and only render correctly in PowerPoint 365, Keynote, or WPS Office. LibreOffice Impress and Google Slides lack the morph renderer and will display a static fade transition instead. This is a client-side limitation, not an error in the generated Open XML, as documented in officecli-pptx/SKILL.md.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →