mathematical animations with haskell https://reanimate.github.io
  • Haskell 95.8%
  • Elm 3.9%
  • Nix 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-02-06 19:32:19 +01:00
.azure Disable hgeometry dependency and bump version. (#282) 2022-06-02 20:09:15 +02:00
.github remove invalid site checking workflow 2025-02-06 19:32:19 +01:00
data Add missing icon. 2020-08-06 19:09:43 +08:00
discord-bot Update stack lts version. (#200) 2021-03-11 13:08:14 +08:00
docs Hierarchical sprites and objects (#269) 2022-06-02 15:40:56 +02:00
examples Fork() and Waitpid() Simulator (#288) 2022-06-12 11:56:42 +02:00
playground Fix cert renewal for web.rgeometry.org 2021-08-11 11:04:02 +08:00
reanimate-examples CI: Check for 404s (#170) 2020-09-23 12:40:39 +08:00
reanimate-morph Fix some hlint warnings, and more consistency in examples (#167) 2020-09-20 22:51:22 +08:00
src Fix build for ghc-9.2 (#301) 2022-12-21 12:21:48 +01:00
test Disable hgeometry dependency and bump version. (#282) 2022-06-02 20:09:15 +02:00
unix Refactor Reanimate.Povray and OS-specifc POVRay 2021-10-17 10:12:28 +08:00
videos Use newest reanimate-svg. (#197) 2021-02-20 18:46:26 +08:00
viewer-elm Bump qs from 6.5.2 to 6.5.3 in /viewer-elm (#302) 2022-12-21 12:22:43 +01:00
windows Refactor Reanimate.Povray and OS-specifc POVRay 2021-10-17 10:12:28 +08:00
.gitignore Improve cabal hacking experience (#215) 2021-09-11 17:43:41 +08:00
.stylish-haskell.yaml Update stylish preferences. 2020-08-27 13:42:59 +08:00
azure-pipelines.yml Add 'signalS' and signalO for applying easing functions to sprites/objects. (#260) 2022-01-23 17:27:43 +01:00
ChangeLog.md Fix build for ghc-9.2 (#301) 2022-12-21 12:21:48 +01:00
default.nix Enable nix. (#172) 2020-09-26 11:12:05 +08:00
Dockerfile.base Update stack lts version. (#200) 2021-03-11 13:08:14 +08:00
Dockerfile.discord Update stack lts version. (#200) 2021-03-11 13:08:14 +08:00
Dockerfile.playground Update stack lts version. (#200) 2021-03-11 13:08:14 +08:00
hie.yaml Improve cabal hacking experience (#215) 2021-09-11 17:43:41 +08:00
LICENSE Use https when possible. 2020-10-01 14:40:05 +08:00
mkdocs.yml Add monthly changelog entries to docs. (#176) 2020-10-05 15:35:19 +08:00
README.md Update documentation links. 2021-07-04 00:25:17 +08:00
reanimate.cabal Fix build for ghc-9.2 (#301) 2022-12-21 12:21:48 +01:00
RESOURCES.md Country distortion video (#54) 2020-02-20 21:22:36 +08:00
run-tests.sh Update test runner script. 2020-08-25 18:22:06 +08:00
Setup.hs First stab at reanimate. 2019-02-13 21:08:49 +01:00
shell.nix Adding haskell.nix based default and shell.nix (#141) 2020-09-02 09:47:04 +08:00
stack-lts-14.yaml Disable hgeometry dependency and bump version. (#282) 2022-06-02 20:09:15 +02:00
stack-lts-15.yaml Disable hgeometry dependency and bump version. (#282) 2022-06-02 20:09:15 +02:00
stack-lts-16.yaml Disable hgeometry dependency and bump version. (#282) 2022-06-02 20:09:15 +02:00
stack-lts-17.yaml Disable hgeometry dependency and bump version. (#282) 2022-06-02 20:09:15 +02:00
stack.yaml Bump stack.yaml to LTS 18.15 2021-11-07 16:51:53 +00:00

Hackage packagename on Stackage LTS packagename on Stackage Nightly Build Status Documentation Status Platforms GitHub repo size API docs coverage Docker Cloud Build Status Discord

Reanimate

Reanimate is a library for programmatically generating animations with a twist towards mathematics / 2D vector drawings. A lot of inspiration was drawn from 3b1b's manim library.

Reanimate aims at being a batteries-included way of gluing together different technologies: SVG as a universal image format, LaTeX for typesetting, ffmpeg for video encoding, inkscape/imagemagick for rasterization, potrace for vectorization, blender/povray for 3D graphics, and Haskell for scripting.

In more practical terms, reanimate is a library for turning code like this:

main = reanimate $ docEnv $ playThenReverseA drawCircle

... into animations like this:

Draw Circle

If you like what you see, boost reanimate's visibility with a star or consider becoming a sponsor ❤.

What is reanimate good at?

Vector graphics and math

Tangent/Normal Fourier

Mapping and tracing

Geo JSON Object tracing

Mathematical typesetting and effects

LaTeX Stars

2D physics and 3D graphics

2D Physics 3D graphics

Prerequisites

Reanimate is built using the Haskell Tool Stack. For installation instructions, see: https://docs.haskellstack.org/en/stable/README/

Optionally, you can install one or more of these programs to enable additional features:

I highly recommend that you install at least 'ffmpeg' and 'latex'.

Getting started / Running an example

Reanimate offers stack templates for getting started with a minimal example and automatic code reloading. Running the commands below will put a one-line animation in the 'animate' folder and then display the animation in a browser window. You can then edit the animation source code and watch the animation update in real time:

$ stack new animate github:reanimate/plain
$ cd animate/
$ # both 'cabal repl' and 'stack repl' can be used here:
$ cabal repl
:cmd reanimateLive

Running examples from the repository

Reanimate has a large collection of small examples which are both used for regression testing and for GIFs in the API reference documentation. You can run these examples by first cloning the repository and then running the examples as if they were executables:

$ git clone https://github.com/reanimate/reanimate.git
$ cd reanimate/
$ stack build
$ stack ./examples/doc_drawCircle.hs

This should render the doc_drawCircle example in a new browser window. Automatic code reloading will not be enabled unless you run :cmd reanimateLive from a GHCi session.

Running examples from the repository using Cabal

It's also possible to use cabal instead of stack:

$ git clone https://github.com/reanimate/reanimate.git
$ cd reanimate/
$ cabal v2-build
$ # Workaround for a cabal bug: https://github.com/haskell/cabal/issues/6235
$ export reanimate_datadir=`pwd`
$ cabal v2-exec -- runhaskell examples/doc_drawCircle.hs

Using Nix

If you'd rather use nix to build an environment with all of the system dependencies mentioned previously do:

$ git clone https://github.com/reanimate/reanimate.git
$ cd reanimate/
$ nix-shell
[nix-shell:./reanimate]$ cabal v2-build --write-ghc-environment-files=always

If you have cachix available run cachix use cdodev before you drop into the nix shell. This will significantly speed things up!

This will write a file in the working directory like .ghc.environment.x86_64-linux-8.8.3 which will enable commands like runhaskell to pick up reanimate.

Now, still within the nix-shell you can run:

[nix-shell:./reanimate]$ reanimate_datadir=. runhaskell examples/doc_drawCircle.hs

Documentation

Features

  • Cross-platform. Official support for Linux, MacOS, and Windows.
  • Well-documented. API reference documentation include GIFs to illustrate behavior, and in-depth tutorial/explanation articles are hosted on readthedocs.io.
  • Advanced type-setting via LaTeX.
  • Voice control: Align animation timings with a transcript.
  • 3D graphics: Built-in support for integrating povray and blender.
  • Mapping: Built-in support for GeoJSON and map projections.
  • Online playground for toying with reanimate scripts.

Roadmap

  • Easy-to-use font selection when using latex/xelatex/luatex.
  • Polygon morphing framework with support for several algorithms, including: linear interpolation, as-rigid-as-possible interpolation, and intersection-free interpolation.
  • Built-in tools for creating presentations.

Authors

  • David Himmelstrup.
  • Jan Hrcek.

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Acknowledgments

  • Huge thanks to 3b1b's manim which inspired this library.
  • Thanks to svg-tree for their SVG library.
  • Thanks to CthulhuDen/chiphunk for making a 2D physics library easily available.
  • Thanks to Peter Johnson for reserving the 'reanimate' organization on GitHub.

YouTube

Completed animations are uploaded to the Reanimated Science channel.

Animation snippets are uploaded to the Reanimated Science Shorts channel.