never executed always true always false
    1 module Reanimate.Builtin.Documentation where
    2 
    3 import Reanimate.Animation
    4 import Reanimate.Svg
    5 import Reanimate.Raster
    6 import Reanimate.Constants
    7 import Codec.Picture
    8 
    9 docEnv :: Animation -> Animation
   10 docEnv = mapA $ \svg -> mkGroup
   11   [ mkBackground "white"
   12   , withFillOpacity 0 $
   13     withStrokeWidth 0.1 $
   14     withStrokeColor "black" (mkGroup [svg]) ]
   15 
   16 -- | <<docs/gifs/doc_drawBox.gif>>
   17 drawBox :: Animation
   18 drawBox = mkAnimation 2 $ \t ->
   19   partialSvg t $ pathify $
   20   mkRect (screenWidth/2) (screenHeight/2)
   21 
   22 -- | <<docs/gifs/doc_drawCircle.gif>>
   23 drawCircle :: Animation
   24 drawCircle = mkAnimation 2 $ \t ->
   25   partialSvg t $ pathify $
   26   mkCircle (screenHeight/3)
   27 
   28 drawBall :: Animation
   29 drawBall = mkAnimation 2 $ \t ->
   30   scale t $ withFillOpacity 1 $ withFillColor "red" $
   31   mkCircle (screenHeight/3)
   32 
   33 -- | <<docs/gifs/doc_drawProgress.gif>>
   34 drawProgress :: Animation
   35 drawProgress = mkAnimation 2 $ \t ->
   36   mkGroup
   37   [ mkLine (-screenWidth/2*widthP,0)
   38            (screenWidth/2*widthP,0)
   39   , translate (-screenWidth/2*widthP + screenWidth*widthP*t) 0 $
   40     withFillOpacity 1 $ mkCircle 0.5 ]
   41   where
   42     widthP = 0.8
   43 
   44 showColorMap :: (Double -> PixelRGB8) -> SVG
   45 showColorMap f = center $ scaleToSize screenWidth screenHeight $ embedImage img
   46   where
   47     width = 256
   48     height = 1
   49     img = generateImage pixelRenderer width height
   50     pixelRenderer x _y = f (fromIntegral x / fromIntegral (width-1))
   51 
   52 rtfdBackgroundColor :: PixelRGBA8
   53 rtfdBackgroundColor = PixelRGBA8 252 252 252 0xFF