reanimate/examples/latex_draw.hs
David Himmelstrup dfd52961ae Use gifs to improve documentation. (#21)
Former-commit-id: 40e5ccedcf5d1ca8f0d5cc373ba3b3c4cc2d6c6a
2019-09-28 21:35:42 +08:00

20 lines
664 B
Haskell
Executable file

#!/usr/bin/env stack
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Reanimate
main :: IO ()
main = reanimate $
bg `parA` (playThenReverseA $ drawText `andThen` fillText)
where
bg = animate $ const $ mkBackground "black"
msg = "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}"
glyphs = withStrokeWidth 0.01 $ center $ latexAlign msg
fillText = mkAnimation 1 $ \t ->
scale 2 $ withFillColor "white" $ withFillOpacity t glyphs
drawText = mkAnimation 2 $ \t ->
scale 2 $
withStrokeColor "white" $ withFillOpacity 0 $
partialSvg t glyphs