1

In the diagrams tutorial the following text appears:

Some backends support rendering animations (typically as individually indexed files of frames).

> -- Animation
>
> a :: Animation Cairo V2 Double
> a = ...
>
> main = mainWith a

So from here I started working on a little animation. I found Diagrams.Animation and discovered that the Animation type is

type Animation b v n = Active (QDiagram b v n Any) 

From there I looked at Data.Active, and was able to build myself a little Animation.

At this point I attempted to compile but was told that my Animation was not Mainable. I supposed that this must mean that my backend Diagrams.Backend.SVG.CmdLine did not support animations. So I went and looked at some other backends, but none that I could find made Animations Mainable.

What backends is the tutorial talking about? That is, what backends support animation?

Community
  • 1
  • 1
Wheat Wizard
  • 3,982
  • 14
  • 34
  • 1
    From a quick skim at the docs for diagrams I found that both the `Cairo` backend and the `Rasterific` backend define a `Mainable (Animation ...)`. And I may have missed a few more. – Mor A. May 16 '18 at 21:41
  • Animations are really backend-agnostic. An animation is basically just a function from time to a diagram of whatever backend you desire. Use [simulate](http://hackage.haskell.org/package/active-0.2.0.13/docs/Data-Active.html#v:simulate) to obtain discrete snapshots of such an animation. – leftaroundabout May 17 '18 at 13:09

1 Answers1

0

diagrams-cairo and diagrams-rasterific can produce animated GIFs from an Animation. diagrams-postscript has a Mainable instance that saves one numbered file for each frame of the Animation.

sarva
  • 77
  • 8
bergey
  • 3,041
  • 11
  • 17