mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-11 16:12:20 +00:00
Add more combinators.
This commit is contained in:
parent
f02195ec61
commit
0992f6144b
2 changed files with 13 additions and 0 deletions
|
|
@ -123,6 +123,13 @@ mapF fn frame = Frame $ \d t -> do
|
|||
pauseAtEnd :: Double -> Animation -> Animation
|
||||
pauseAtEnd p a = a `andThen` pause p
|
||||
|
||||
pauseAtBeginning :: Double -> Animation -> Animation
|
||||
pauseAtBeginning d1 a =
|
||||
Animation d1 (freezeFrame 0 a) `before` a
|
||||
|
||||
freezeFrame :: Double -> Animation -> Frame ()
|
||||
freezeFrame t (Animation d f) = Frame $ \_ _ -> unFrame f d t
|
||||
|
||||
adjustSpeed :: Double -> Animation -> Animation
|
||||
adjustSpeed factor (Animation d fn) =
|
||||
Animation (d/factor) $ Frame $ \_dur t -> unFrame fn d (t*factor)
|
||||
|
|
|
|||
|
|
@ -518,6 +518,9 @@ withFillColorPixel color = fillColor .~ pure (ColorRef color)
|
|||
withFillOpacity :: Double -> Tree -> Tree
|
||||
withFillOpacity opacity = fillOpacity .~ Just (realToFrac opacity)
|
||||
|
||||
withGroupOpacity :: Double -> Tree -> Tree
|
||||
withGroupOpacity opacity = groupOpacity .~ Just (realToFrac opacity)
|
||||
|
||||
withStrokeWidth :: Number -> Tree -> Tree
|
||||
withStrokeWidth width = strokeWidth .~ pure width
|
||||
|
||||
|
|
@ -557,6 +560,9 @@ mkDefinitions :: [Tree] -> Tree
|
|||
mkDefinitions forest = DefinitionTree $ defaultSvg
|
||||
& groupChildren .~ forest
|
||||
|
||||
mkUse :: String -> Tree
|
||||
mkUse name = UseTree (defaultSvg & useName .~ name) Nothing
|
||||
|
||||
mkClipPath :: String -> [Tree] -> Tree
|
||||
mkClipPath idTag forest = withId idTag $ ClipPathTree $ (defaultSvg
|
||||
& clipPathContent .~ forest)
|
||||
|
|
|
|||
Loading…
Reference in a new issue