Slide animations
Folio reads, edits, plays and writes PowerPoint animations and transitions. Three layers, each usable alone:
| Package | What |
|---|---|
@nextgensoftwares/folio-slides | the model: Slide.timing (effects, triggers, builds), Slide.transition |
@nextgensoftwares/folio-pptx | p:timing / p:bldLst / p:transition in and out |
@nextgensoftwares/folio-slides-motion | DOM-free playback, presets, transitions, morph, the show controller, editor commands (/editor) |
@nextgensoftwares/folio-plugin-slides-motion | React: canvas stage, slide show, presenter view, animation pane, transitions panel |
Add it to an editor
import { motionUiPlugin } from '@nextgensoftwares/folio-plugin-slides-motion';
const deck = createDeckEditor({ presentation, plugins: [motionUiPlugin()] });
<SlidesApp deck={deck} measurer={fonts} resolveSrc={media.resolve} />With SlidesApp's ribbon, the Transitions and Animations tabs fill in PowerPoint's layout (Preview, the effect gallery, Effect options, Advanced animation, Timing); the inspector gains an Animation pane tab (and a Transitions tab with transitionsPane: true); the Slide Show tab gains Presenter view and Rehearse timings. Animated shapes show their click numbers on the canvas, and Present plays the animations. Without React, the same commands run on the headless editor:
import { motionPlugin } from '@nextgensoftwares/folio-slides-motion/editor';
const deck = createDeckEditor({ presentation, plugins: [motionPlugin()] });
deck.select(['5']);
deck.exec('animation.add', { preset: 'fly', subtype: 8 }); // fly in from the left, on click
deck.exec('animation.add', { preset: 'fade', shapes: ['3'], byParagraph: true, start: 'after' });
deck.exec('animation.timing', { ids: [id], delay: 250, duration: 800, repeat: 2 });
deck.exec('animation.trigger', { ids: [id], shape: '7' }); // plays when shape 7 is clicked
deck.exec('transition.apply', { type: 'push', options: { dir: 'u' }, duration: 700, all: true });The model
A slide's timing is the animation pane, not the XML tree: main is the ordered click sequence, each AnimEffect with its class (entrance, emphasis, exit, motion path), PowerPoint preset id and direction, target (a shape, a paragraph range, the shape without its text), start (on click, with previous, after previous), delay, repeat/rewind and an optional by-word/by-letter build; triggers are sequences played by clicking a shape. The behaviours inside each effect are the PresentationML ones (set, anim with key times and formulas, animEffect filters, animScale, animRot, animMotion, animClr); anything else is kept as XML. Presets only generate behaviours the way PowerPoint writes them, so the player plays exactly what a file says, whoever wrote it.
Round trip
- An untouched slide is copied byte for byte; a slide whose shapes changed keeps its
p:timingas it was. - Edited timing is regenerated (fresh
cTnids, PowerPoint's click/with/after nesting,bldLst) and passes the ECMA-376 XSDs and the Open XML SDK validator. - Effects on deleted shapes are dropped on export (PowerPoint repairs a file whose timing points at missing shapes).
- Transitions: base effects plainly; exact durations and Office extension effects (morph, reveal, vortex...) in
mc:AlternateContentwith a base fallback, as PowerPoint writes them.
What every option does, end to end
Each row is checked by tests: UI (the panel control changes the model: plugin-slides-motion/src/__tests__/panels.dom.test.tsx), model (the deck command), playback (the engine / show controller plays it), export (the written .pptx passes the structural validator, the ECMA-376 XSDs and the Open XML SDK, Office 2007 and Microsoft 365 rules) and re-import (reads back to the same model): slides-motion/src/__tests__/transitions-audit.test.ts, animations-audit.test.ts (124 decks written), pptx/src/__tests__/timing.test.ts.
| Option | UI | Model | Playback | Export | Re-import |
|---|---|---|---|---|---|
| Transition effects: fade (smooth / through black), push, wipe, split, reveal, cover, uncover, zoom, random bars, shape, dissolve, cut, none | ✓ | ✓ | ✓ | ✓ | ✓ |
Morph (Office 2019+, p159:morph in mc:AlternateContent, fade fallback) | ✓ | ✓ | ✓ shapes matched by !!name, id, name, text; position, size, rotation interpolate; fill and outline colours tween; the same text moves, resizes and recolours run by run (other text, other geometry or fill types cross-fade); text never stretched; unbuilt shapes and unmatched ones fade (morph-tween.test.ts) | ✓ | ✓ |
| Effect options (every direction / orientation of each effect) | ✓ | ✓ | ✓ | ✓ | ✓ |
Duration (exact ms via p14:dur) | ✓ | ✓ | ✓ | ✓ | ✓ |
| Sound | shown, removable | kept (Transition.sound: src, loop, stop) | ✓ played on entry (MediaLayer; host's muted; refused before a user gesture: "Click to turn on sound"; a loop plays until the next sound; "stop previous sound") | kept on the slide's part; left out of new parts | ✓ |
Effect sounds (p:audio) | (file only) | raw XML + sound.src | ✓ at the effect's start + delay (ShowController.cues, cues.test.ts, media.dom.test.tsx) | ✓ (XML kept) | ✓ (sounds.test.ts) |
Media commands (p:cmd play / playFrom / pause / resume / stop / toggle) | (file only) | raw XML + cmd | ✓ the video plays over its frame, audio plays; leaving the slide stops them | ✓ (XML kept) | ✓ |
| On click / after N s | ✓ | ✓ | ✓ (ShowController.tick) | ✓ | ✓ |
| Apply to all | ✓ | ✓ | ✓ | ✓ | ✓ |
| Animation effects: 18 entrance, 12 emphasis, 17 exit, 3 motion paths + custom path, each direction | ✓ (gallery, Effect / Direction) | ✓ | ✓ (entrances hidden before, exits gone after, every effect moves mid-way) | ✓ | ✓ |
| Start: on click / with previous / after previous; delay; duration | ✓ | ✓ | ✓ | ✓ | ✓ |
| Repeat (2–10, until end of slide), rewind | ✓ | ✓ | ✓ | ✓ | ✓ |
| Text: by paragraph, by word, by letter | ✓ | ✓ | ✓ words and letters placed by the layout engine's glyph positions, each drawn on its own (elements.test.ts) | ✓ | ✓ |
| Effects on shapes inside a group (and on the group) | (file only) | ✓ | ✓ each child animates on its own inside the group's own effect (group-render.test.ts) | ✓ | ✓ |
| Reveals (wipe, split...) on rotated shapes | ✓ | ✓ | ✓ along the rotated box | ✓ | ✓ |
| Triggers (on click of a shape) | ✓ | ✓ | ✓ (ShowController.click) | ✓ | ✓ |
| Reorder, change effect, remove | ✓ | ✓ | ✓ | ✓ | ✓ |
| Preview (gallery hover, Play, transition hover) | ✓ | (none) | ✓ | (none) | (none) |
| Presenter view: next build/slide, notes, timer, clock, counter, see all slides, black/white, laser, pen, highlighter, eraser, keep ink, rehearse timings, audience windows | ✓ | ink → shapes, timings → advance after | ✓ (show.test.ts, render.test.ts) | ink shapes and timings export as ordinary shapes / advTm | ✓ |
Playback
ShowController evaluates any moment: frame().motion.of(shape, part) returns visibility, opacity, offset, scale, rotation, shear, a reveal clip and colour tweens, or null when nothing animates it. The evaluator follows SMIL as PowerPoint uses it: key times with formulas (#ppt_x, #ppt_h, $), calcmode, additive behaviours, accel/decel, autoReverse, repeat, tmFilter, fill (hold or removed), entrance shapes hidden until they enter, by-word / by-letter iteration with tmPct/tmAbs. The React stage draws still shapes from cached layers and moving ones live.
| Played exactly | Approximated |
|---|---|
appear, fade, fly in/out, float, wipe, split, zoom, grow & turn, spinner, bounce, shape (circle), wheel, random bars, blinds, checkerboard, dissolve, wedge, diamond; pulse, grow/shrink, spin, teeter, transparency, fill/line/font colour, darken, lighten, desaturate, complementary; motion paths (lines, arcs, loops, custom); any file's p:anim/p:set/filters | pictures morph by cross-fade when their image or crop differ; text whose runs differ between the two slides cross-fades |
Transitions: none, cut, fade (smooth / through black), push, wipe, split, reveal, cover, uncover, zoom, random bars, blinds, checker, circle, diamond, plus, wedge, wheel, strips, newsflash, flash, dissolve, and morph (shapes matched by !!name, id, name or text; position, size and rotation interpolate, fill and outline colours tween, the same text moves, resizes and recolours run by run). Other Office effects play as a fade (import reports transition-approx).
Host theming and optional parts: the panels, ribbon content, badges and collaboration UI read Folio's --folio-* tokens (map yours with FolioHostTheme); with setFolioUnstyled(true) none of their CSS is injected (class names are stable: .fsm-*, .fsc-*). SlidesApp's features removes them cleanly: present: false (show, presenter view, rehearse, Alt+F5), transitions: false (Transitions tab and pane), animations: false (Animations tab, Animation pane, numbers on the slide).
Reduced motion: motionUiPlugin({ motion: 'system' }) (the default) follows prefers-reduced-motion: builds jump to their end, transitions cut. 'full' and 'reduced' force it.
Performance: evaluating a 50-shape slide with paragraph builds takes about 0.13 ms per frame (Node); painting it while every shape moves averages 3–7 ms per frame in Chrome (no dropped frames at 60 Hz).