diff --git a/haddock.txt b/haddock.txt index ef332d5..daaadb7 100644 --- a/haddock.txt +++ b/haddock.txt @@ -7,6 +7,8 @@ 100% ( 9 / 9) in 'Reanimate.Voice' 100% ( 9 / 9) in 'Reanimate.Povray' 100% ( 9 / 9) in 'Reanimate.Constants' + 100% ( 8 / 8) in 'Reanimate.Builtin.TernaryPlot' + 100% ( 6 / 6) in 'Reanimate.Builtin.Images' 100% ( 5 / 5) in 'Reanimate.Transform' 100% ( 4 / 4) in 'Reanimate.Svg.BoundingBox' 100% ( 3 / 3) in 'Reanimate.Blender' @@ -18,7 +20,6 @@ 81% ( 92 /114) in 'Reanimate.Scene' 75% ( 6 / 8) in 'Reanimate.Builtin.Documentation' 75% ( 3 / 4) in 'Reanimate.Svg.Unuse' - 67% ( 4 / 6) in 'Reanimate.Builtin.Images' 62% ( 23 / 37) in 'Reanimate.Internal.CubicBezier' 56% ( 10 / 18) in 'Reanimate.Svg' 50% ( 1 / 2) in 'Reanimate.Builtin.CirclePlot' @@ -32,7 +33,6 @@ 6% ( 1 / 18) in 'Reanimate.Svg.LineCommand' 0% ( 0 / 13) in 'Reanimate.Morph.Common' 0% ( 0 / 10) in 'Reanimate.ColorSpace' - 0% ( 0 / 10) in 'Reanimate.Builtin.TernaryPlot' 0% ( 0 / 8) in 'Reanimate.Misc' 0% ( 0 / 8) in 'Reanimate.Math.Balloon' 0% ( 0 / 7) in 'Reanimate.Morph.Linear' diff --git a/haddock_badge.json b/haddock_badge.json index 3bb8b33..2db4f48 100644 --- a/haddock_badge.json +++ b/haddock_badge.json @@ -1 +1 @@ - { "schemaVersion": 1, "label": "api docs", "message": "67%", "color": "success" } + { "schemaVersion": 1, "label": "api docs", "message": "68%", "color": "success" } diff --git a/playground/snippets.js b/playground/snippets.js index e4332ad..b09b3d6 100644 --- a/playground/snippets.js +++ b/playground/snippets.js @@ -8,4 +8,4 @@ const snippets = [{"title": "Hello World","url": "https://reanimate.clozecards.c ,{"title": "Easing Graphs","url": "https://reanimate.clozecards.com/FEyCDsj0V82/255.svg","code": "colorPalette = parula -- try: viridis, sinebow, turbo, cividis\nfns =\n [(\"curveS\", curveS 2)\n ,(\"bellS\", bellS 2)\n ,(\"constantS\", constantS 0.7)\n ,(\"oscillateS\", oscillateS)\n ,(\"powerS\", powerS 2)\n ,(\"reverseS\", reverseS)\n ,(\"id\", id)\n ]\n\nanimation :: Animation\nanimation = docEnv $ pauseAtEnd 1 $ sceneAnimation $ do\n newSpriteSVG_ $ mkBackground \"white\"\n play $ signalA (curveS 2) $ animate $ \\t -> partialSvg t grid\n newSpriteSVG_ grid\n wait 1\n flip mapM_ (zip [0..] fns) $ \\(nth, (txt, fn)) -> do\n let color = promotePixel $ colorPalette (nth / fromIntegral (length fns-1))\n showEasing nth txt fn color\n {- showEasing 3 \"oscillateS\" oscillateS\n showEasing 4 \"powerS\" (powerS 2)\n showEasing 5 \"reverseS\" reverseS\n showEasing 6 \"id\" id -}\n\ngridOffset = -2\ngridHeight = 5\ngridWidth = 8\n\ngrid :: SVG\ngrid = translate gridOffset 0 $\n withStrokeWidth defaultStrokeWidth $\n withStrokeColor \"grey\" $ mkGroup\n [ mkPath $ concat\n [[ SVG.MoveTo SVG.OriginAbsolute [V2 (-gridWidth/2) (gridHeight/2-n)]\n ,SVG.HorizontalTo SVG.OriginRelative [gridWidth] ]\n | n <- [1..gridHeight-1]\n ]\n , mkPath \n [ SVG.MoveTo SVG.OriginAbsolute [V2 (-gridWidth/2) (gridHeight/2)]\n , SVG.VerticalTo SVG.OriginRelative [-gridHeight]\n , SVG.HorizontalTo SVG.OriginRelative [gridWidth]\n , SVG.VerticalTo SVG.OriginRelative [gridHeight]\n , SVG.EndPath\n ]\n ]\n\nshowEasing nth txt fn color = do\n let steps = 100\n slope = withStrokeColorPixel color $\n translate gridOffset 0 $ mkLinePath\n [ ((x/steps-0.5)*gridWidth, (y-0.5)*gridHeight)\n | x <- [0..steps]\n , let y = fn (x/steps) ]\n s <- newSpriteSVG $\n withFillColorPixel color $\n translate (gridWidth/2+gridOffset+0.5) (gridHeight/2-nth) $\n label txt\n spriteE s $ overBeginning 0.2 fadeInE\n play $ animate $ \\t -> partialSvg t slope\n newSpriteSVG_ slope\n wait 1\n \nlabel txt = withStrokeColor \"black\" $\n withStrokeWidth (defaultStrokeWidth*2) $\n withFillOpacity 1 $\n latex txt\n"} ,{"title": "Object Positions","url": "https://reanimate.clozecards.com/IAQhjO0Ke7h/195.svg","code": "env =\n addStatic (mkBackground \"white\") .\n mapA (withStrokeColor \"black\")\n\nanimation :: Animation\nanimation = env $\n sceneAnimation $ do\n -- Configure objects\n txt <- newText \"Center\"\n top <- newText \"Top\"\n oModifyS top $ \n oTopY .= screenTop\n topR <- newText \"Top right\"\n oModifyS topR $ do\n oTopY .= screenTop\n oRightX .= screenRight\n botR <- newText \"Bottom right\"\n oModifyS botR $ do\n oBottomY .= screenBottom\n oRightX .= screenRight\n botL <- newText \"Bottom left\"\n oModifyS botL $ do\n oBottomY .= screenBottom\n oLeftX .= screenLeft\n topL <- newText \"Top left\"\n oModifyS topL $ do\n oTopY .= screenTop\n oLeftX .= screenLeft\n -- Show objects\n oShow txt\n wait 1\n switchTo txt top\n switchTo top topR\n switchTo topR botR\n switchTo botR botL\n switchTo botL topL\n switchTo topL txt\n\nswitchTo src dst = do\n fork $ oFadeOut src 1\n oModify dst $ oOpacity .~ 1\n oFadeIn dst 1\n wait 1\n\nnewText txt =\n newObject $ scale 1.5 $ center $ latex txt\n"} ]; -const playgroundVersion = "2020-08-25 (cc215)"; +const playgroundVersion = "2020-08-25 (41d6a)"; diff --git a/reanimate-0.4.1.0-inplace/Reanimate.Builtin.Images.hs.html b/reanimate-0.4.1.0-inplace/Reanimate.Builtin.Images.hs.html index ee9244d..5be7e8b 100644 --- a/reanimate-0.4.1.0-inplace/Reanimate.Builtin.Images.hs.html +++ b/reanimate-0.4.1.0-inplace/Reanimate.Builtin.Images.hs.html @@ -17,62 +17,74 @@ span.spaces { background: white } never executed always true always false
- 1 module Reanimate.Builtin.Images - 2 ( svgLogo - 3 , haskellLogo - 4 , githubIcon - 5 , githubWhiteIcon - 6 , smallEarth - 7 ) where + 1 {-| + 2 Module : Reanimate.Builtin.Images + 3 Copyright : Written by David Himmelstrup + 4 License : Unlicense + 5 Maintainer : lemmih@gmail.com + 6 Stability : experimental + 7 Portability : POSIX 8 - 9 import Codec.Picture - 10 import qualified Data.ByteString as B - 11 import Graphics.SvgTree (parseSvgFile) - 12 import Paths_reanimate - 13 import Reanimate.Animation - 14 import Reanimate.Svg - 15 import System.IO.Unsafe - 16 - 17 embedImage :: FilePath -> IO SVG - 18 embedImage key = do - 19 svg_file <- getDataFileName key - 20 svg_data <- B.readFile svg_file - 21 case parseSvgFile svg_file svg_data of - 22 Nothing -> error "Malformed svg" - 23 Just svg -> return $ embedDocument svg - 24 - 25 loadJPG :: FilePath -> Image PixelRGBA8 - 26 loadJPG key = unsafePerformIO $ do - 27 jpg_file <- getDataFileName key - 28 dat <- B.readFile jpg_file - 29 case decodeJpeg dat of - 30 Left err -> error err - 31 Right img -> return $ convertRGBA8 img - 32 - 33 {- HLINT ignore svgLogo -} - 34 -- | <<docs/gifs/doc_svgLogo.gif>> - 35 svgLogo :: SVG - 36 svgLogo = unsafePerformIO $ embedImage "data/svg-logo.svg" - 37 - 38 {- HLINT ignore haskellLogo -} - 39 -- | <<docs/gifs/doc_haskellLogo.gif>> - 40 haskellLogo :: SVG - 41 haskellLogo = unsafePerformIO $ embedImage "data/haskell.svg" - 42 - 43 {- HLINT ignore githubIcon -} - 44 -- | <<docs/gifs/doc_githubIcon.gif>> - 45 githubIcon :: SVG - 46 githubIcon = unsafePerformIO $ embedImage "data/github-icon.svg" - 47 - 48 {-# NOINLINE githubWhiteIcon #-} - 49 githubWhiteIcon :: SVG - 50 githubWhiteIcon = unsafePerformIO $ embedImage "data/github-icon-white.svg" - 51 - 52 -- | 300x150 equirectangular earth - 53 -- - 54 -- <<docs/gifs/doc_smallEarth.gif>> - 55 smallEarth :: Image PixelRGBA8 - 56 smallEarth = loadJPG "data/small_earth.jpg" + 9 Collection of built-in images. + 10 + 11 -} + 12 module Reanimate.Builtin.Images + 13 ( svgLogo + 14 , haskellLogo + 15 , githubIcon + 16 , githubWhiteIcon + 17 , smallEarth + 18 ) where + 19 + 20 import Codec.Picture + 21 import qualified Data.ByteString as B + 22 import Graphics.SvgTree (parseSvgFile) + 23 import Paths_reanimate + 24 import Reanimate.Animation + 25 import Reanimate.Svg + 26 import System.IO.Unsafe + 27 + 28 embedImage :: FilePath -> IO SVG + 29 embedImage key = do + 30 svg_file <- getDataFileName key + 31 svg_data <- B.readFile svg_file + 32 case parseSvgFile svg_file svg_data of + 33 Nothing -> error "Malformed svg" + 34 Just svg -> return $ embedDocument svg + 35 + 36 loadJPG :: FilePath -> Image PixelRGBA8 + 37 loadJPG key = unsafePerformIO $ do + 38 jpg_file <- getDataFileName key + 39 dat <- B.readFile jpg_file + 40 case decodeJpeg dat of + 41 Left err -> error err + 42 Right img -> return $ convertRGBA8 img + 43 + 44 {- HLINT ignore svgLogo -} + 45 -- | <<docs/gifs/doc_svgLogo.gif>> + 46 svgLogo :: SVG + 47 svgLogo = unsafePerformIO $ embedImage "data/svg-logo.svg" + 48 + 49 {- HLINT ignore haskellLogo -} + 50 -- | <<docs/gifs/doc_haskellLogo.gif>> + 51 haskellLogo :: SVG + 52 haskellLogo = unsafePerformIO $ embedImage "data/haskell.svg" + 53 + 54 {- HLINT ignore githubIcon -} + 55 -- | <<docs/gifs/doc_githubIcon.gif>> + 56 githubIcon :: SVG + 57 githubIcon = unsafePerformIO $ embedImage "data/github-icon.svg" + 58 + 59 {-# NOINLINE githubWhiteIcon #-} + 60 -- | <<docs/gifs/doc_githubWhiteIcon.gif>> + 61 githubWhiteIcon :: SVG + 62 githubWhiteIcon = unsafePerformIO $ embedImage "data/github-icon-white.svg" + 63 + 64 -- | 300x150 equirectangular earth + 65 -- + 66 -- <<docs/gifs/doc_smallEarth.gif>> + 67 smallEarth :: Image PixelRGBA8 + 68 smallEarth = loadJPG "data/small_earth.jpg"