Improve haddock documentation. (#20)

* Improve CLI help message.

* Change hackage badge color.

* Add supported platforms.

* Add 'signalOscillate'

* Split SVG module into smaller parts.

Former-commit-id: ad62a06a5442912f6bd0be0e10d02fe53345b846
This commit is contained in:
David Himmelstrup 2019-09-28 16:24:41 +08:00 committed by GitHub
commit c2af9fbac0
51 changed files with 1474 additions and 1518 deletions

View file

@ -6,61 +6,58 @@ module Main (main) where
import Control.Lens
import Graphics.SvgTree
import Reanimate.Driver (reanimate)
import Reanimate.LaTeX
import Reanimate.Monad
import Reanimate.Svg
import Reanimate.Signal
import Reanimate.Combinators
import Reanimate
main :: IO ()
main = reanimate $ autoReverse $ mkAnimation 5 $ do
s <- getSignal $ signalFromTo 0 1.5 $ signalCurve 2
emit $ mkBackground "black"
emit $ FilterTree $ mkFilter "blur"
[FEGaussianBlur $ defaultSvg
& gaussianBlurStdDeviationX .~ Num dev
& filterResult .~ Just "blur"
] & filterWidth .~ pure (Percent 3)
& filterX .~ pure (Percent (-1))
& filterHeight .~ pure (Percent 3)
& filterY .~ pure (Percent (-1))
emit $ FilterTree $ mkFilter "goo"
[FEGaussianBlur $ defaultSvg
& gaussianBlurStdDeviationX .~ Num dev
& filterResult .~ Just "blur"
,FEColorMatrix $ defaultSvg
& colorMatrixType .~ Matrix
& colorMatrixValues .~ "1 0 0 0 0 \
\0 1 0 0 0 \
\0 0 1 0 0 \
\0 0 0 " ++ show (sharpness*2) ++ " -" ++ show sharpness
& filterResult .~ pure "goo"
,FEComposite $ defaultSvg
& compositeIn .~ pure SourceGraphic
& compositeIn2 .~ pure (SourceRef "goo")
& compositeOperator .~ CompositeAtop
] & filterWidth .~ pure (Percent 3)
& filterX .~ pure (Percent (-1))
& filterHeight .~ pure (Percent 3)
& filterY .~ pure (Percent (-1))
emit $ translate 0 (radius*2.2) $ withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ
, translate (s*radius) 0 circ
main = reanimate $ playThenReverseA $ mkAnimation 5 $ \t ->
let s = signalFromTo 0 1.5 (signalCurve 2) t in
mkGroup
[ mkBackground "black"
, FilterTree $ mkFilter "blur"
[FEGaussianBlur $ defaultSvg
& gaussianBlurStdDeviationX .~ Num dev
& filterResult .~ Just "blur"
] & filterWidth .~ pure (Percent 3)
& filterX .~ pure (Percent (-1))
& filterHeight .~ pure (Percent 3)
& filterY .~ pure (Percent (-1))
, FilterTree $ mkFilter "goo"
[FEGaussianBlur $ defaultSvg
& gaussianBlurStdDeviationX .~ Num dev
& filterResult .~ Just "blur"
,FEColorMatrix $ defaultSvg
& colorMatrixType .~ Matrix
& colorMatrixValues .~ "1 0 0 0 0 \
\0 1 0 0 0 \
\0 0 1 0 0 \
\0 0 0 " ++ show (sharpness*2) ++ " -" ++ show sharpness
& filterResult .~ pure "goo"
,FEComposite $ defaultSvg
& compositeIn .~ pure SourceGraphic
& compositeIn2 .~ pure (SourceRef "goo")
& compositeOperator .~ CompositeAtop
] & filterWidth .~ pure (Percent 3)
& filterX .~ pure (Percent (-1))
& filterHeight .~ pure (Percent 3)
& filterY .~ pure (Percent (-1))
, translate 0 (radius*2.2) $ withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ
, translate (s*radius) 0 circ
]
, withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ
, translate (s*radius) 0 circ
] & filterRef .~ pure (Ref "blur")
, translate 0 (-radius*2.2) $ withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ
, translate (s*radius) 0 circ
] & filterRef .~ pure (Ref "goo")
]
emit $ withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ
, translate (s*radius) 0 circ
] & filterRef .~ pure (Ref "blur")
emit $ translate 0 (-radius*2.2) $ withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ
, translate (s*radius) 0 circ
] & filterRef .~ pure (Ref "goo")
where
sharpness = 10
sharpness = 10 :: Integer
dev = 0.2
radius = 1
circ = mkCircle (Num radius)
circ = mkCircle radius
mkFilter :: String -> [FilterElement] -> Filter
mkFilter ident fe = defaultSvg & filterChildren .~ fe & attrId .~ Just ident