This commit is contained in:
David 2019-03-07 14:42:27 +01:00
commit d1d1906250
3 changed files with 10 additions and 4 deletions

View file

@ -782,7 +782,9 @@ gooEffect = mkAnimation 5 $ do
& compositeIn .~ pure SourceGraphic & compositeIn .~ pure SourceGraphic
& compositeIn2 .~ pure (SourceRef "goo") & compositeIn2 .~ pure (SourceRef "goo")
& compositeOperator .~ CompositeAtop & compositeOperator .~ CompositeAtop
] & filterHeight .~ pure (Percent 3) ] & filterWidth .~ pure (Percent 3)
& filterX .~ pure (Percent (-1))
& filterHeight .~ pure (Percent 3)
& filterY .~ pure (Percent (-1)) & filterY .~ pure (Percent (-1))
emit $ translate 0 (-radius*2) $ withFillColor "red" $ mkGroup emit $ translate 0 (-radius*2) $ withFillColor "red" $ mkGroup
[ translate (s*(-radius)) 0 circ [ translate (s*(-radius)) 0 circ
@ -799,7 +801,7 @@ gooEffect = mkAnimation 5 $ do
where where
sharpness = 60 sharpness = 60
dev = 10 dev = 10
radius = 25 radius = 30
circ = CircleTree $ defaultSvg circ = CircleTree $ defaultSvg
& circleCenter .~ (Num 0, Num 0) & circleCenter .~ (Num 0, Num 0)
& circleRadius .~ Num radius & circleRadius .~ Num radius

View file

@ -53,11 +53,13 @@ renderFormat :: Format -> Animation -> FilePath -> IO ()
renderFormat format ani target = do renderFormat format ani target = do
putStrLn $ "Starting render of animation: " ++ show (round (duration ani)) ++ "s" putStrLn $ "Starting render of animation: " ++ show (round (duration ani)) ++ "s"
ffmpeg <- requireExecutable "ffmpeg" ffmpeg <- requireExecutable "ffmpeg"
generateFrames ani 320 fps $ \template -> generateFrames ani 640 fps $ \template ->
withTempFile "txt" $ \progress -> writeFile progress "" >>
case format of case format of
RenderMp4 -> RenderMp4 ->
runCmd ffmpeg ["-r", show fps, "-i", template, "-y" runCmd ffmpeg ["-r", show fps, "-i", template, "-y"
, "-c:v", "libx264", "-vf", "fps="++show fps , "-c:v", "libx264", "-vf", "fps="++show fps
, "-progress", progress
, "-pix_fmt", "yuv420p", target] , "-pix_fmt", "yuv420p", target]
RenderGif -> withTempFile "png" $ \palette -> do RenderGif -> withTempFile "png" $ \palette -> do
runCmd ffmpeg ["-i", template, "-y" runCmd ffmpeg ["-i", template, "-y"
@ -66,12 +68,14 @@ renderFormat format ani target = do
, palette ] , palette ]
runCmd ffmpeg ["-i", template, "-y" runCmd ffmpeg ["-i", template, "-y"
,"-i", palette ,"-i", palette
,"-progress", progress
,"-filter_complex" ,"-filter_complex"
,"fps="++show fps++",scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" ,"fps="++show fps++",scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse"
,"-t", show (duration ani) ,"-t", show (duration ani)
, target] , target]
RenderWebm -> RenderWebm ->
runCmd ffmpeg ["-r", show fps, "-i", template, "-y" runCmd ffmpeg ["-r", show fps, "-i", template, "-y"
,"-progress", progress
, "-c:v", "libvpx-vp9", "-vf", "fps="++show fps , "-c:v", "libvpx-vp9", "-vf", "fps="++show fps
, target] , target]
RenderBlank -> return () RenderBlank -> return ()

View file

@ -3,7 +3,7 @@ resolver: lts-11.22
allow-newer: false allow-newer: false
extra-deps: extra-deps:
- reanimate-svg-0.8.0.0 - reanimate-svg-0.8.1.0
- diagrams-1.4@sha256:3e36369e84115b900fd9dcb570672a188339a470eb19ca62170775cd835cf8ca - diagrams-1.4@sha256:3e36369e84115b900fd9dcb570672a188339a470eb19ca62170775cd835cf8ca
- diagrams-contrib-1.4.3@sha256:bcfa6c85f8c33b8c48c3a61b7216afdebd51cd793c50da3a2dd358827d25fc76 - diagrams-contrib-1.4.3@sha256:bcfa6c85f8c33b8c48c3a61b7216afdebd51cd793c50da3a2dd358827d25fc76
- diagrams-core-1.4.1.1@sha256:6ef6b17785d77997c481eb085570e21b6a00cc91d086fbf49490504130ebc7d1 - diagrams-core-1.4.1.1@sha256:6ef6b17785d77997c481eb085570e21b6a00cc91d086fbf49490504130ebc7d1