Use newest reanimate-svg. (#197)

This commit is contained in:
David Himmelstrup 2021-02-20 18:46:26 +08:00 committed by GitHub
commit 0e580e0fdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 39 additions and 33 deletions

View file

@ -18,7 +18,6 @@ import Codec.Picture.Types
import Control.Lens hiding (magma)
import Control.Monad
import Data.Fixed
import Data.Monoid
import Graphics.SvgTree
import Linear.V2
import Linear.Vector
@ -129,7 +128,7 @@ main = reanimate $ scene $ do
& filterWidth .~ pure (Percent 1)
& filterHeight .~ pure (Percent 1)
, FETurbulence $ defaultSvg
& turbulenceBaseFrequency .~ (2, Last Nothing)
& turbulenceBaseFrequency .~ (2, Nothing)
& turbulenceType .~ FractalNoiseType
& turbulenceNumOctaves .~ 1
& turbulenceSeed .~ 1

View file

@ -12,7 +12,6 @@ import Reanimate.Builtin.Documentation
import Codec.Picture.Types
import Control.Lens ((&), (^.))
import Control.Monad
import Data.Monoid
import qualified Data.Text as T
import Graphics.SvgTree
import NeatInterpolation
@ -252,7 +251,7 @@ drawAnimation' :: Maybe Int -> Double -> Double -> SVG -> Animation
drawAnimation' mbSeed fillDur step svg = scene $ do
forM_ (zip [0..] $ shuf $ svgGlyphs svg) $ \(n, (fn, attr, tree)) -> do
let sWidth =
case toUserUnit defaultDPI <$> getLast (attr ^. strokeWidth) of
case toUserUnit defaultDPI <$> (attr ^. strokeWidth) of
Just (Num d) -> d
_ -> defaultStrokeWidth
fork $ do

View file

@ -11,7 +11,6 @@ import Codec.Picture
import Codec.Picture.Types
import Control.Lens ((&), (^.))
import Control.Monad
import Data.Monoid
import Graphics.SvgTree
import System.Random
import "random-shuffle" System.Random.Shuffle
@ -75,7 +74,7 @@ drawAnimation' :: Maybe Int -> Double -> Double -> SVG -> Animation
drawAnimation' mbSeed fillDur step svg = scene $ do
forM_ (zip [0..] $ shuf $ svgGlyphs svg) $ \(n, (fn, attr, tree)) -> do
let sWidth =
case toUserUnit defaultDPI <$> getLast (attr ^. strokeWidth) of
case toUserUnit defaultDPI <$> (attr ^. strokeWidth) of
Just (Num d) -> d
_ -> defaultStrokeWidth
fork $ do

View file

@ -13,7 +13,6 @@ import Codec.Picture
import Codec.Picture.Types
import Control.Lens ((&), (^.))
import Control.Monad
import Data.Monoid
import Data.Text (Text)
import qualified Data.Text as T
import Graphics.SvgTree hiding (Text)
@ -146,7 +145,7 @@ drawAnimation' :: Maybe Int -> Double -> Double -> SVG -> Animation
drawAnimation' mbSeed fillDur step svg = scene $ do
forM_ (zip [0..] $ shuf $ svgGlyphs svg) $ \(n, (fn, attr, tree)) -> do
let sWidth =
case toUserUnit defaultDPI <$> getLast (attr ^. strokeWidth) of
case toUserUnit defaultDPI <$> (attr ^. strokeWidth) of
Just (Num d) -> d
_ -> defaultStrokeWidth
fork $ do

View file

@ -13,7 +13,6 @@ import Codec.Picture
import Codec.Picture.Types
import Control.Lens ((^.),(&))
import Control.Monad
import Data.Monoid
import Data.Text (Text)
import qualified Data.Text as T
import Graphics.SvgTree hiding (Text)
@ -183,7 +182,7 @@ drawAnimation' :: Maybe Int -> Double -> Double -> SVG -> Animation
drawAnimation' mbSeed fillDur step svg = scene $ do
forM_ (zip [0..] $ shuf $ svgGlyphs svg) $ \(n, (fn, attr, tree)) -> do
let sWidth =
case toUserUnit defaultDPI <$> getLast (attr ^. strokeWidth) of
case toUserUnit defaultDPI <$> (attr ^. strokeWidth) of
Just (Num d) -> d
_ -> defaultStrokeWidth
fork $ do

View file

@ -150,7 +150,7 @@ library
process >=1.6.3.0,
random >=1.1,
random-shuffle >=0.0.4,
reanimate-svg >=0.13.0.0,
reanimate-svg >=0.13.0.1,
split >=0.2.3.3,
temporary >=1.3,
text >=1.2.3.0,

View file

@ -42,7 +42,6 @@ import Control.Monad.State (runState, state)
import qualified Data.ByteString as B
import Data.Foldable (Foldable (fold))
import Data.Hashable (Hashable)
import Data.Monoid (Last (Last))
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
@ -192,7 +191,7 @@ postprocess =
. lowerIds
. mapTree clearDrawAttr
where
clearDrawAttr t = t & strokeColor .~ Last Nothing
clearDrawAttr t = t & strokeColor .~ Nothing
enginePostprocess :: TexEngine -> Tree -> Tree
enginePostprocess LuaLaTeX svg = translate 0 (svgHeight svg) svg
@ -202,7 +201,7 @@ removeClipPaths :: SVG -> SVG
removeClipPaths = mapTree worker
where
worker ClipPathTree {} = None
worker t = t & clipRule .~ Last Nothing & clipPathRef .~ Last Nothing
worker t = t & clipRule .~ Nothing & clipPathRef .~ Nothing
-- executable, arguments, header, tex
latexToSVG :: TexEngine -> String -> String -> [String] -> Text -> IO Tree

View file

@ -44,18 +44,18 @@ runCmd_ exec args = do
_ <- evaluate (length stdout + length errMsg)
case ret of
ExitSuccess -> return (Right stdout)
ExitFailure err
| False ->
return $
Left $
"Failed to run: "
++ showCommandForUser exec args
++ "\n"
++ "Error code: "
++ show err
++ "\n"
++ "stderr: "
++ errMsg
-- ExitFailure err
-- | False ->
-- return $
-- Left $
-- "Failed to run: "
-- ++ showCommandForUser exec args
-- ++ "\n"
-- ++ "Error code: "
-- ++ show err
-- ++ "\n"
-- ++ "stderr: "
-- ++ errMsg
ExitFailure {}
| null errMsg -> -- LaTeX prints errors to stdout. :(
return $ Left stdout

View file

@ -5,7 +5,6 @@ module Reanimate.Scene.Object where
import Control.Lens
import Control.Monad (forM_, void)
import Control.Monad.State (State, execState)
import Data.Monoid (Last (getLast))
import Graphics.SvgTree (Number (..), Tree, pattern None, strokeWidth, toUserUnit)
import Linear.V2 (R1 (_x), R2 (_y), V2 (..))
import Linear.Vector (Additive (lerp), (^*))
@ -500,7 +499,7 @@ oDraw :: SVG -> Animation
oDraw = oStagger $ \svg -> scene $
forM_ (svgGlyphs $ pathify svg) $ \(ctx, attr, node) -> do
let sWidth =
case toUserUnit defaultDPI <$> getLast (attr ^. strokeWidth) of
case toUserUnit defaultDPI <$> (attr ^. strokeWidth) of
Just (Num d) -> max defaultStrokeWidth d
_ -> defaultStrokeWidth
-- wait 1

View file

@ -6,7 +6,7 @@ packages:
- .
extra-deps:
- reanimate-svg-0.13.0.0
- reanimate-svg-0.13.0.1
- chiphunk-0.1.2.1
- cubicbezier-0.6.0.6@sha256:2191ff47144d9a13a2784651a33d340cd31be1926a6c188925143103eb3c8db3
- fast-math-1.0.2@sha256:91181eb836e54413cc5a841e797c42b2264954e893ea530b6fc4da0dccf6a8b7

View file

@ -8,7 +8,7 @@ packages:
extra-deps:
- chiphunk-0.1.2.1
- earcut-0.1.0.4@sha256:d5118b3eecf24d130263d81fb30f1ff56b1db43036582bfd1d8cc9ba3adae8be,1010
- reanimate-svg-0.13.0.0
- reanimate-svg-0.13.0.1
- hgeometry-0.11.0.0@sha256:09ead201a6ac3492c0be8dda5a6b32792b9ae87cab730b8362d46ee8d5c2acb4,11714
- hgeometry-combinatorial-0.11.0.0@sha256:03176f235a1c49a415fe1266274dafca84deb917cbcbf9a654452686b4cd2bfe,8286
- vinyl-0.13.0@sha256:0f247cd3f8682b30881a07de18e6fec52d540646fbcb328420049cc8d63cd407,3724

13
stack-lts-17.yaml Normal file
View file

@ -0,0 +1,13 @@
resolver: lts-17.4
allow-newer: false
packages:
- .
extra-deps:
- earcut-0.1.0.4
- reanimate-svg-0.13.0.1
- hgeometry-0.11.0.0@sha256:09ead201a6ac3492c0be8dda5a6b32792b9ae87cab730b8362d46ee8d5c2acb4,11714
- hgeometry-combinatorial-0.11.0.0@sha256:03176f235a1c49a415fe1266274dafca84deb917cbcbf9a654452686b4cd2bfe,8286
- vinyl-0.13.0@sha256:0f247cd3f8682b30881a07de18e6fec52d540646fbcb328420049cc8d63cd407,3724

View file

@ -1,4 +1,4 @@
resolver: lts-16.27
resolver: lts-16.31
allow-newer: false
@ -7,7 +7,7 @@ packages:
extra-deps:
- earcut-0.1.0.4
- reanimate-svg-0.13.0.0
- reanimate-svg-0.13.0.1
- hgeometry-0.11.0.0@sha256:09ead201a6ac3492c0be8dda5a6b32792b9ae87cab730b8362d46ee8d5c2acb4,11714
- hgeometry-combinatorial-0.11.0.0@sha256:03176f235a1c49a415fe1266274dafca84deb917cbcbf9a654452686b4cd2bfe,8286
- vinyl-0.13.0@sha256:0f247cd3f8682b30881a07de18e6fec52d540646fbcb328420049cc8d63cd407,3724

View file

@ -294,7 +294,7 @@ drawAnimation' :: Double -> Double -> SVG -> Animation
drawAnimation' fillDur step svg = scene $ do
forM_ (zip [0..] $ svgGlyphs svg) $ \(n, (fn, attr, tree)) -> do
let sWidth =
case toUserUnit defaultDPI <$> getLast (attr ^. strokeWidth) of
case toUserUnit defaultDPI <$> (attr ^. strokeWidth) of
Just (Num d) -> d
_ -> defaultStrokeWidth
fork $ do