Skip to main content

touying-reducer

Extend external packages with pause and meanwhile animation support.

Wraps an external drawing/diagram function (like cetz.canvas or fletcher.diagram) so that Touying can intercept pause/meanwhile markers inside its content array and hide/cover items across subslides.

Define package-specific wrappers once at the top of your document:

// CeTZ
#let cetz-canvas = touying-reducer.with(
reduce: cetz.canvas,
cover: cetz.draw.hide.with(bounds: true),
)

// Fletcher
#let fletcher-diagram = touying-reducer.with(
reduce: fletcher.diagram,
cover: fletcher.hide,
)
Parameters

reduce : function    default: arr => arr.sum()

The external drawing function. It should accept an array of drawing commands and return rendered content (e.g. cetz.canvas or fletcher.diagram).

cover : function    default: arr => none

Called with a drawing command when that command should be hidden on the current subslide. Should produce invisible but space-preserving content (e.g. cetz.draw.hide.with(bounds: true) or fletcher.hide).

..args : arguments

The positional and named arguments passed to the reduce function.

Returns: content