Drawing Metapost animations
15 July, 2018 (2 minute read). Category: Metapost. Tags: metapost, animation.
The animation module provides a nice interface for using
FieldStacks to create a JavaScript controlled animations in
ConTeXt.1 For example, the following code will show step-1.pdf
,
step-2.pdf
, step-3.pdf
, and step-4.pdf
files one by one:
\usemodule[animation]
\startanimation[menu=yes]
{\useexternalfigure[step-1.pdf]}
{\useexternalfigure[step-2.pdf]}
{\useexternalfigure[step-3.pdf]}
{\useexternalfigure[step-4.pdf]}
\stopanimation
Sometimes, I use animation to give the illusion of motion. For example, to
show a particle moving along a trajectory (drawn using Metapost). In
principle, it is possible to use the animation
module to draw such
animations (e.g., see Wolfgang’s reply in on ntg-context mailing list), but the
interface gets a bit cumbersome. In this post, I show a helper macro to
simplify drawing such animations.