Asymptote-based scientific animation

Cover Page

Cite item


This article discusses a universal way to create animation using Asymptote the language for vector graphics. The Asymptote language itself has a built-in library for creating animations, but its practical use is complicated by an extremely brief description in the official documentation and unstable execution of existing examples. The purpose of this article is to eliminate this gap. The method we describe is based on creating a PDF-file with frames using Asymptote, with further converting it into a set of PNG images and merging them into a video using FFmpeg. All stages are described in detail, which allows the reader to use the described method without being familiar with the used utilities.

Full Text

1. Introduction In this paper we study the creation of animation animation using the vector graphics language Asymptote [1-4]. Asymptote is an interpreted language, that is a translator into the PostScript vector graphics language. Designed to create vector images for mathematical publications. It is closely integrated with the TEX system and is an integral part of the TEX Live [5] distribution. It has a C-like syntax, supports the creation of functions, custom data structures, and comes with an extensive set of modules for various tasks. Unlike PGF/TikZ [6], Asymptote is more imperative, so it is easier to implement complex program logic on it. In the official documentation of this language, only a few paragraphs are devoted to the animation creation process and the user is referred to the source code examples located in the animations directory. Asymptote creates animation in two steps. At the first step, a multi-page PDF-file is created containing images that will become frames of future animation. Then, using the external utility ImageMagick [7] (command convert), this PDF-file is converted into a GIF image. If the ImageMagick utility is not installed on the user’s system, all examples will stop at creating a multi-page PDF-file with a set of images and a GIF image with animation will not be received. In this article, we are considering a universal way to create animation in video format using the ffmpeg [8, 9] and Ghostscript [10] utilities. All external programs will be called explicitly from the command line. With the help of Asymptote, only a multi-page PDF-file with frames for the future video will be created. The reader should be familiar with the basic capabilities of the Asymptote language. For an introduction to the basics of the language, we recommend the manual [11]. The information from it will be enough to understand this work. As an example, we chose the animation of the process of constructing epitrochoids and hypotrochoids. In the first part of the work, we will recall the definitions of these curves, some of their properties and reduce their construction to a composition of two rotations. In the second part of the article, we will describe in detail the implementation of their construction using Asymptote. And in the third part we will focus on the technical side of the issue and describe the process of creating a multi-page PDF-file, converting it into PNG images using Ghostscript and converting these images into video using ffmpeg. 2. Task description Consider the task of animating the process of constructing cycloidal curves, namely hypotrochoids and epitrochoids. We will not use the parametric equation of these curves, but will reduce everything to the composition of two rotations applied to the starting point of the curve. This will better illustrate the capabilities of the Asymptote language. 2.1. Definition of epitrochoids Epitrochoid is defined as a trajectory plotted by a fixed point

About the authors

Migran N. Gevorkyan

RUDN University

ORCID iD: 0000-0002-4834-4895

Candidate of Sciences in Physics and Mathematics, Associate Professor of Department of Applied Probability and Informatics

6, Miklukho-Maklaya St., Moscow, 117198, Russian Federation

Anna V. Korolkova

RUDN University

ORCID iD: 0000-0001-7141-7610

Candidate of Sciences in Physics and Mathematics, Associate Professor of Department of Applied Probability and Informatics

6, Miklukho-Maklaya St., Moscow, 117198, Russian Federation

Dmitry S. Kulyabov

RUDN University; Joint Institute for Nuclear Research

Author for correspondence.
ORCID iD: 0000-0002-0877-7063

Doctor of Sciences in Physics and Mathematics, Professor of the Department of Applied Probability and Informatics of Peoples’ Friendship University of Russia named after Patrice Lumumba (RUDN University); Senior Researcher of Laboratory of Information Technologies, Joint Institute for Nuclear Research

6, Miklukho-Maklaya St., Moscow, 117198, Russian Federation; 6, Joliot-Curie St., Dubna, Moscow Region, 141980, Russian Federation


  1. O. Shardt and J. C. Bowman, “Surface parameterization of nonsimply connected planar Bézier regions,” Computer-Aided Design, vol. 44, no. 5, 484.e1-484.e10, May 2012. doi: 10.1016/j.cad.2011.05.010
  2. J. C. Bowman, “Asymptote: Interactive TEX-aware 3D vector graphics,” TUGboat, vol. 31, no. 2, pp. 203-205, 2010.
  3. J. C. Bowman and A. Hammerlindl, “Asymptote: A vector graphics language,” TUGboat, vol. 29, no. 2, pp. 288-294, 2008.
  4. J. C. Bowman. “Asymptote: The Vector Graphics Language.” (May 2023), [Online]. Available:
  5. “TeX Live.” (2023), [Online]. Available:
  6. T. Tantau and H. Menke. “PGF/TikZ.” (2023), [Online]. Available:
  7. “ImageMagick.” (Jun. 12, 2020), [Online]. Available:
  8. S. Tomar, “Converting video formats with FFmpeg,” Linux Journal, vol. 2006, no. 146, p. 10, 2006.
  9. “FFmpeg Website.” (2023), [Online]. Available: [10] “Ghostscript Website.” (2023), [Online]. Available: https ://
  10. C. I. Staats. “An Asymptote tutorial.” (2015), [Online]. Available: https: //

Copyright (c) 2023 Gevorkyan M.N., Korolkova A.V., Kulyabov D.S.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

This website uses cookies

You consent to our cookies if you continue to use our website.

About Cookies