reanimate / reanimate Goto Github PK
View Code? Open in Web Editor NEWHaskell library for building declarative animations based on SVG graphics
Home Page: https://reanimate.github.io
License: The Unlicense
Haskell library for building declarative animations based on SVG graphics
Home Page: https://reanimate.github.io
License: The Unlicense
In Stackage builds:
Test suite failure for package reanimate-0.1.8.0
spec: exited with: ExitFailure 1
Full log available at /var/stackage/work/unpack-dir/.stack-work/logs/reanimate-0.1.8.0-test.log
spec: examples/: getDirectoryContents:openDirStream: does not exist (No such file or directory)
If you open the example file morphology_linear.hs and replace stages
with something like
stages = map (lowerTransformations . scale 0.8 . pathify . center) $ colorize
[ latex "$e^{i\\pi}+1=0$",
latex "hello W$\\xrightarrow{\\text{orl}}d$"
]
it will not compile. It stays stuck on "Frames generated: 0/480"
Am I doing something wrong?
Pretty much all other animation libraries and frameworks call them easing functions. So rename Reanimate.Signals to Reanimate.Ease and also add more predefined easing functions from: https://easings.net/
The Driver haddocks mention some key commands
Key commands for pausing, frame stepping, forward/rewind.
Could you please recommend the available key commands in the haddocks?
Maybe it would be even better if those commands were discoverable in the web ui itself (via help link? As buttons?)
I installed ffmpeg
using the bundled MSYS2
from stack
, and it is not compiled with --enable-librsvg
, so I installed rsvg
separately. Today I realized that in the generated video, all transparency-related effects are gone. It appears as if the alpha channel were simply dropped:
PixelRGBA8
(with e.g. alpha=0.5) produces exactly the same result as alpha=1;fadeInE
/fadeOutE
has no effect;I suspect that it is due to RasterRSvg
, so I tried with ImageMagick
, and surprisingly I get a completely white video. I really don't have much experience on ffmpeg
, rsvg
, etc., so I have no idea what's going on.
I'll try run my program on WSL
(Arch Linux
and Ubuntu
), and MacOS
, for I guess this weird behaviour only happens on Windows. I'll post my result here, so that someone might be able to spot the actual problem. FYI, my code can be found in my GitHub repo.
It should be Reanimate.ColorComponents
Here are two clips I generated using your package (very nice piece of work!):
The problem is, they are generated using the same code with only one difference, the render flag.
My code is based on the tut_glue_animate example.
https://gist.github.com/irisyupingren/aea8716904ea511dd1f66ffa6c382918
Is there any way to get this working on Windows? Here's what I've tried so far:
unix
dependency, which oddly enough doesn't actually seem to be used anywhere. After removing it I was able to build reanimate
fine.latex_color.hs
example, but got the following output (with other actions I did in [indented square brackets]
):> stack .\latex_color.hs
Failed to open browser. Manually visit: C:\Users\bradn\Documents\Haskell\reanimate\.stack-work\install\b7328101\share\x86_64-windows-ghc-8.2.2\reanimate-0.1.4.1\viewer/build/index.html
[Here I manually visited the given location]
Server pending.
Found self. Listening.
Kill and respawn.
[Here I refreshed the page on my web browser]
Server pending.
latex_color.hs: CloseRequest 1001 ""
Found self. Listening.
Kill and respawn.
latex_color.hs: DeleteFile "C:\\Users\\bradn\\AppData\\Local\\Temp\\reanimate-XXXXXX35312-1.exe": permission denied (Access is denied.)
latex_color.hs: C:\Users\bradn\AppData\Local\Temp\reanimate-XXXXXX35312-2.exe: runInteractiveProcess: invalid argument (Exec format error)
permission denied
error above, I tried running as an administator, and got the following output instead:> stack .\latex_color.hs
Failed to open browser. Manually visit: C:\Users\bradn\Documents\Haskell\reanimate\.stack-work\install\b7328101\share\x86_64-windows-ghc-8.2.2\reanimate-0.1.4.1\viewer/build/index.html
Server pending.
Found self. Listening.
Kill and respawn.
[Here I manually visited the given location]
Server pending.
Found self. Listening.
Kill and respawn.
latex_color.hs: C:\Users\bradn\AppData\Local\Temp\reanimate-XXXXXX30972-2.exe: runInteractiveProcess: invalid argument (Exec format error)
Use case: I want to generate an animation with a script based on reanimate
.
I want to specify just one dimension, so I run
./script.hs render -w 100
Expected behavior:
the height is calculated so that aspect ratio of the animation is preserved AND I don't have to do manual calculation to determine how much I should shrink the height to preserve aspect ratio.
Actual behavior:
the height remains at default value (1440) so the output looks like 1440x100 noodle :-)
Would you agree that if exactly one of -w / -h is provided, the other should be recalculated? If yes, I can do a PR implementing that.
It would be nice to be able to enjoy the code reloading without using stack. Perhaps just replacing "stack ghc ..." with "ghc ..." would work. An option for this would be super.
Frames are rendered in parallel and, thus, if two frames try to raster the same SVG image, work is duplicated. This can be "solved" by locking cached files before generating them. It won't lower the total render time but at least it'll burn fewer cycles.
The number of cache conflicts should be counted and reported. If this number is high, different (non-linear) rendering orderings can be used.
The 'diagrams' dependency is a bit heavy and it isn't tied to the core of Reanimate. Offer integration as a separate 'reanimate-diagrams' package.
For some of the examples the output is:
Compilation failed
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
12 | import Data.String.Here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The *.golden files are cluttering the examples directory. Those files should be moved into a 'golden' subdirectory and the test script should be updated to look for them there.
It's not clear that pathify only works on circles/rectangles/lines. Is there a technical reason why it doesn't work e.g. on polylines, polygons or ellipses? This limitation should be either documented or the missing functionality should be implemented. I can tackle these, but I need to know which is the case.
I am trying to test this library by using the getting started instructions, and am stuck on this step:
$ stack runhaskell ./latex_color.hs
There doesn’t seem to be a latex_color.hs
file anywhere. Could you correct these instructions?
rsvg isn't 100% compliant with the SVG spec. Inkscape is a heavy dependency, though, so it should be optional.
Stream frames directly to ffmpeg to take better advantage of multiple cores.
Does it require any other dependencies?
reanimate-master\examples\fourier.hs:36:12: error:
? Variable not in scope:
signal :: Integer -> Double -> Frame Double
? Perhaps you meant ‘signum’ (imported from Prelude)
|
36 | phi <- signal 0 (2*pi)
| ^^^^^^
Some text fragments in generated golden files on Windows have a different kind of encoding or escaping, causing the regression suite to fail. Affected tests are: blender_sphere and doc_xelatex.
Implementing time dependent variables as Time -> a
is convenient but inefficient. It would be better to use a map to values and tweening functions.
When using the web-frontend, the animation code is loaded (and reloaded when changed) in a background process and any messages to stderr are silently ignored. These messages should be sent to stderr of the main process.
Some videos take hours to render. It would be helpful to display time spent + estimated time to completion.
It might be useful to see what's going on when code is reloaded.
Right now animations are defined as:
data Animation = Animation Duration (Time -> SVG)
and this definition is exported. This definition will definitely change in the future (to support generating presentations) so the constructor must be hidden. The constructor is directly used in a few other modules but it should be possible to use 'duration', 'getAnimationFrame' and 'mkAnimation' instead.
Hi, I'm trying to get reanimate working under a nix shell, running the following command just seems to produce a blank mp4 file
runhaskell doc_drawBox.hs render --format mp4
My check looks like
[nix-shell:~/reanimate/examples]$ runhaskell doc_drawBox.hs check
reanimate checks:
Has ffmpeg: 4.2.2
Has LaTeX: 'latex'' not found
Has XeLaTeX: 'xelatex'' not found
Has dvisvgm: 'dvisvgm'' not found
Has povray: 'povray'' not found
Has LaTeX package 'babel': n/a
Has LaTeX package 'preview': n/a
Has LaTeX package 'amsmath': n/a
Has LaTeX package 'amssymb': n/a
Has LaTeX package 'dsfont': n/a
Has LaTeX package 'setspace': n/a
Has LaTeX package 'relsize': n/a
Has LaTeX package 'textcomp': n/a
Has LaTeX package 'mathrsfs': n/a
Has LaTeX package 'calligra': n/a
Has LaTeX package 'wasysym': n/a
Has LaTeX package 'ragged2e': n/a
Has LaTeX package 'physics': n/a
Has LaTeX package 'xcolor': n/a
Has LaTeX package 'textcomp': n/a
Has LaTeX package 'xfrac': n/a
Has LaTeX package 'microtype': n/a
Has XeLaTeX package 'ctex': n/a
It seems the name 'reanimate' is already taken but that user-account looks inactive. Hi @reanimate, if you don't use your account, may I have it?
Ideally, each exported function would have a description as well as an example animation. Not all functions can be illustrated with an animation, though.
I'm running into an ffmpeg error when trying to render my animation to mp4.
Here is the complete command line output:
Starting render of animation: 77.5
Frames rendered: 2325/2325, time spent: 25s
tshark-tests: /usr/bin/ffmpeg -r 30 -i '/tmp/reanimate1799-0/render-%05d.png' -y '-c:v' libx264 -vf 'fps=30' -preset slow -crf 18 -movflags '+faststart' -progress /tmp/reanimate1799-1.txt -pix_fmt yuv420p output.mp4:
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[image2 @ 0x556bcb9340c0] Could find no file with path '/tmp/reanimate1799-0/render-%05d.png' and index in the range 0-4
/tmp/reanimate1799-0/render-%05d.png: No such file or directory
I tested this with both reanimate-0.3.3.0 and reanimate-0.4.0.0, both give the same error message.
I'm using the render method directly, because recompiling takes way too long for my tastes. This is a minimal example that gives the same error:
module Main (main) where
import Reanimate
import Reanimate.Render
main :: IO ()
main = render (mkAnimation dur $
mkCircle . fromToS 0 (dur*60-1))
"output.mp4"
RasterAuto
RenderMp4
1280
720
30
where
dur = 2
While building reanimate in Windows 10, I am getting this error, though I searched on Stack Exchange and Google, it problem is due to improper installation of Scipy. But I checked that both Lapack and Blas are installed. I am using anaconda, so scipy gots installed automatically.
hmatrix > configure
hmatrix > Configuring hmatrix-0.20.0.0...
hmatrix > Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe: Missing dependencies on foreign
hmatrix > libraries:
hmatrix > * Missing (or bad) C libraries: blas, lapack
hmatrix > This problem can usually be solved by installing the system packages that
hmatrix > provide these libraries (you may need the "-dev" versions). If the libraries
hmatrix > are already installed but in a non-standard location then you can use the
hmatrix > flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.If
hmatrix > the library files do exist, it may contain errors that are caught by the C
hmatrix > compiler at the preprocessing stage. In this case you can re-run configure
hmatrix > with the verbosity flag -v3 to see the error messages.
-- While building package hmatrix-0.20.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 configure --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\1758616a\pkgdb --libdir=C:\sr\snapshots\1758616a\lib --bindir=C:\sr\snapshots\1758616a\bin --datadir=C:\sr\snapshots\1758616a\share --libexecdir=C:\sr\snapshots\1758616a\libexec --sysconfdir=C:\sr\snapshots\1758616a\etc --docdir=C:\sr\snapshots\1758616a\doc\hmatrix-0.20.0.0 --htmldir=C:\sr\snapshots\1758616a\doc\hmatrix-0.20.0.0 --haddockdir=C:\sr\snapshots\1758616a\doc\hmatrix-0.20.0.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.13.0.0 --dependency=binary=binary-0.8.7.0 --dependency=bytestring=bytestring-0.10.10.0 --dependency=deepseq=deepseq-1.4.4.0 --dependency=random=random-1.1-CUqV1zxrwrE4K5XCdTZSYy --dependency=semigroups=semigroups-0.19.1-KswQSjRjA2JDrzoYmnhZUy --dependency=split=split-0.2.3.4-KyPtAwfJzED2zEIheQpqQL --dependency=storable-complex=storable-complex-0.2.3.0-Ar2v6n6lk14548CkBJ9DCu --dependency=vector=vector-0.12.1.2-AWRYcz9jfa25Avs2q9Jg9V -f-disable-default-paths -f-openblas --extra-include-dirs=C:\Users\kshan\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include --extra-lib-dirs=C:\Users\kshan\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib --extra-lib-dirs=C:\Users\kshan\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths Process exited with code: ExitFailure 1
Please help how I can workout this issue.
Latex and povray results differ ever so slightly across linux, mac and windows. This makes it impossible to use those tools in test cases.
Figure out if there's a way to normalize their output (or set flags to guarantee consistent output).
Many morphing algorithms rely on deconstructing polygons into triangles (aka triangulation). However, not all triangles are created equal and there's a lower angle limit where the algorithms break down. Floating point trigonometry is never exact and with long, skinny triangles, the noise drown out the signal.
Below are examples of the same algorithm trying to morph an 'S' into a 'C'. In the first GIF, polygon count is low, the triangles are reasonably sized, and the morphing works as intended. In the second GIF, there are a lot more triangles and they are much skinnier, leading to numerical problems and a jerky morph.
These numerical problems can be avoided by smoothing the mesh inside of the polygon.
Tasks necessary for mesh smoothing:
I know, this here just moved to the new location..
But the Playground is coming back, right? 😄
Old URL does not work anymore: https://lemmih.github.io/reanimate/
Hello, I'm newbie. I couldn't cabal-install Reanimate library: https://prnt.sc/pxyqrs - got two errors when compiling Reanimate.Svg.Unuse.
Is it fixable? If yes, how and what did I do wrong?
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.