packages feed

reanimate 1.1.1.0 → 1.1.2.0

raw patch · 6 files changed

+31/−93 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -6,6 +6,17 @@ project adheres to the [Haskell Package Versioning Policy (PVP)](https://pvp.haskell.org) +## 1.1.2.0 -- 2020-10-27++### Added++ * Reanimate.LaTeX.latexCfgChunks.++### Other/Non-visible++ * xeLaTeX bug fixes.+ * Documentation for external data sets.+ ## 1.1.1.0 -- 2020-10-10  ### Added
− examples/bug_use.hs
@@ -1,11 +0,0 @@-#!/usr/bin/env stack--- stack runghc --package reanimate-{-# LANGUAGE OverloadedStrings #-}-module Main(main) where--import Reanimate-import Reanimate.Builtin.Documentation--main :: IO ()-main = reanimate $ docEnv $-    staticFrame 1 $ latex "\\textbf{$\\textsf{2}^{\\textsf{16}}$}"
− examples/fe_distortion.hs
@@ -1,68 +0,0 @@-#!/usr/bin/env stack--- stack runghc --package reanimate--{-# LANGUAGE ApplicativeDo #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE QuasiQuotes #-}--module Main (main) where--{- FE articles/demos-scatter: https://codepen.io/mullany/pen/JmgbRB-distortion: https://codepen.io/mullany/pen/BWKePz-variable stroke width: https://codepen.io/mullany/pen/qaONQm-variable stroke gradient: https://codepen.io/mullany/pen/XXBMJd-heart: https://codepen.io/yoksel/pen/MLVjoB-elastic stroke: https://codepen.io/yoksel/pen/XJbzrO--}--import qualified Data.Text as T-import Graphics.SvgTree-import Reanimate-import NeatInterpolation-import Control.Monad--main :: IO ()-main = reanimate $-  scene $ do-    newSpriteSVG_ $ mkBackground "white"-    hue <- newVar 0-    dScale <- newVar 0.2-    newSprite $-      mkDistortFilter <$> unVar hue <*> unVar dScale-    newSpriteSVG_ $ parseSvg "<circle r=\"3\" fill=\"red\" filter=\"url(#distort)\" />"-    fork $ replicateM_ 5 $ tweenVar hue 1 $ \_v -> fromToS 0 360-    tweenVar dScale 1 $ \v -> fromToS v 1.0-    tweenVar dScale 1 $ \v -> fromToS v 0.2-    tweenVar dScale 1 $ \v -> fromToS v 0.5-    tweenVar dScale 1 $ \v -> fromToS v 1.0-    tweenVar dScale 1 $ \v -> fromToS v 0.2---- wait 1---- hue: 0 -> 360 over 1s--- dScale: 0;20;50;0 over 5s-mkDistortFilter :: Double -> Double -> SVG-mkDistortFilter hue dScale = parseSvg [text|-  <filter id="distort">-    <feTurbulence baseFrequency="0.7" type="fractalNoise"/>-    <feColorMatrix type="hueRotate" values="${hue'}">-    </feColorMatrix>-    <feDisplacementMap in="SourceGraphic" xChannelSelector="R" yChannelSelector="B"-      scale="${dScale'}">-      </feDisplacementMap>-    <feGaussianBlur stdDeviation="0.02"/>-    <feComponentTransfer result="main">-      <feFuncA type="gamma" amplitude="1" exponent="10"/>-    </feComponentTransfer>-    <feColorMatrix type="matrix" values="0 0 0 0 0 -                                         0 0 0 0 0-                                         0 0 0 0 0-                                         0 0 0 1 0"/>-    <feGaussianBlur stdDeviation="0.2"/>-    <feComposite operator="over" in="main"/>-  </filter>-  |]-  where-    hue' = T.pack (show hue)-    dScale' = T.pack (show dScale)
reanimate.cabal view
@@ -3,7 +3,7 @@ --  see http://haskell.org/cabal/users-guide/  name:                reanimate-version:             1.1.1.0+version:             1.1.2.0 -- synopsis: -- description: license:             PublicDomain
src/Reanimate/External.hs view
@@ -155,7 +155,6 @@     Nothing    -> error $ "Key not found in simple-icons dataset: " ++ show key     Just pixel -> pixel --- | Complete list of all Simple Icons. simpleIconColors :: Map String PixelRGB8 simpleIconColors = unsafePerformIO $ do   let path = simpleIconsFolder </> "_data" </> "simple-icons.json"@@ -198,6 +197,7 @@           _           -> error $ "Invalid hex: " ++ (take 2 $ drop offset hex)  {-# NOINLINE simpleIcons #-}+-- | Complete list of all Simple Icons. simpleIcons :: [String] simpleIcons = unsafePerformIO $ do   let folder = simpleIconsFolder </> "icons"@@ -222,7 +222,7 @@     then pure path     else error $ "Key not found in svg logos dataset: " ++ show key --- | Icons from <https://svgporn.com/>. Version 3.11.0. License: CC0+-- | Icons from <https://svgporn.com/>. Version 2018.01. License: CC0 -- -- @ -- `svgLogo` "cassandra"
src/Reanimate/LaTeX.hs view
@@ -43,8 +43,8 @@ import qualified Data.Text.Encoding   as T import qualified Data.Text.IO         as T import           GHC.Generics         (Generic)-import           Graphics.SvgTree     (Tree, clipPathRef, clipRule, mapTree, parseSvgFile,-                                       pattern ClipPathTree, pattern None, strokeColor)+import           Graphics.SvgTree     (pattern ClipPathTree, pattern None, Tree, clipPathRef,+                                       clipRule, mapTree, parseSvgFile, strokeColor) import           Reanimate.Animation  (SVG) import           Reanimate.Cache      (cacheDiskSvg, cacheMem) import           Reanimate.External   (zipArchive)@@ -109,18 +109,24 @@   where     script = mkTexScript exec args headers (T.unlines (postscript ++ [tex])) --- | Invoke latex and separate results.-latexChunks :: [T.Text] -> [Tree]-latexChunks chunks | pNoExternals = map mkText chunks-latexChunks chunks = worker (svgGlyphs $ latex $ T.concat chunks) chunks+-- | Invoke latex using a given configuration and separate results.+latexCfgChunks :: TexConfig -> [T.Text] -> [Tree]+latexCfgChunks _cfg chunks | pNoExternals = map mkText chunks+latexCfgChunks cfg chunks = worker chunks $ svgGlyphs $ tex $ T.concat chunks   where+    tex = latexCfg cfg     merge lst = mkGroup [fmt svg | (fmt, _, svg) <- lst]     worker [] [] = []-    worker _ [] = error "latex chunk mismatch"-    worker everything (x : xs) =-      let width = length $ svgGlyphs (latex x)-       in merge (take width everything) : worker (drop width everything) xs+    worker [] _ = error "latex chunk mismatch"+    worker (x : xs) everything =+      let width = length $ svgGlyphs (tex x)+          (first, rest) = splitAt width everything+       in merge first : worker xs rest +-- | Invoke latex and separate results.+latexChunks :: [T.Text] -> [Tree]+latexChunks = latexCfgChunks (TexConfig LaTeX [] [])+ -- | Invoke xelatex and import the result as an SVG object. SVG objects are --   cached to improve performance. Xelatex has support for non-western scripts. xelatex :: Text -> Tree@@ -128,7 +134,7 @@  -- | Invoke xelatex with extra script headers. xelatexWithHeaders :: [T.Text] -> T.Text -> Tree-xelatexWithHeaders = someTexWithHeaders XeLaTeX "xelatex" "xdv" [] ["-no-pdf"]+xelatexWithHeaders = someTexWithHeaders XeLaTeX "xelatex" "xdv" ["-no-pdf"] []  -- | Invoke xelatex with "\usepackage[UTF8]{ctex}" and import the result as an --   SVG object. SVG objects are cached to improve performance. Xelatex has