Code Monkey home page Code Monkey logo

reanimate's Issues

spec: examples/: does not exist

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)

cf commercialhaskell/stackage#4830

Trouble with morphology examples

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?

Rename Reanimate.Signals

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/

Document key commands of the web viewer

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?)

Transparency seems ignored with RasterRSvg

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:

  • Providing a semi-transparent 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.

Get working on Windows

Is there any way to get this working on Windows? Here's what I've tried so far:

  1. The first problem is the unix dependency, which oddly enough doesn't actually seem to be used anywhere. After removing it I was able to build reanimate fine.
  2. After building I tried to run the provided 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)
  1. After the 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)

Preserve aspect ratio when generating with only one of -w/-h

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.

Can code reloading work without stack

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.

Lock cache files before generating them

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.

Compilation failed for examples.

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
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Declutter examples directory

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.

Document limitation or expand implementation of pathify

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.

Windows Issues

  • FFmpeg usually isn't built with --lib-rsvg. Detect this and show installation instructions for rsvg-bin or ImageMagick?
    Reanimate now prints an error message in this case.
  • hmatrix is a nightmare to build on Windows. Automatically disable hmatrix dependency on windows? This would disable the advanced morphing algorithms.
    hmatrix is disabled by default on Windows. I've managed to install it successfully but it is somewhat complicated. I'll add instructions to the README file.
  • Provide docker image that encapsulates all of reanimate (ghc + FFmpeg + latex + reanimate). Are docker images easy to use on Windows? Would people prefer native solutions?
  • The web-viewer doesn't work with Edge.
  • The web-viewer shows a poor error message if it fails to compile its own source code.
  • Terminating the web-viewer backend with CTRL-C triggers a huge 'access violation' message.

cabal exec -- ghc *\fourier.hs

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)
| ^^^^^^

Encoding issue for golden files on Windows

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.

Improve time variable efficiency.

Implementing time dependent variables as Time -> a is convenient but inefficient. It would be better to use a map to values and tweening functions.

Web-frontend: Print error messages to stderr.

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.

Hide the Animation constructor

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.

Trying to render just results in a blank file.

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

Create organization.

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?

Reduce the size of the reanimate repository

  • Let imgur host rendered animations (except for GIFs, those are needed for the documentation).
  • Move papers out to a separate repo.
  • Use BFG to clear out the dead files from git history.

Implement all filter effects.

  • FEBlend
  • FEColorMatrix
  • FEComponentTransfer
  • FEComposite
  • FEConvolveMatrix
  • FEDiffuseLighting
  • FEDisplacementMap
  • FEDropShadow
  • FEFlood
  • FEFuncA
  • FEFuncB
  • FEFuncG
  • FEFuncR
  • FEGaussianBlur
  • FEImage
  • FEMerge
  • FEMergeNode
  • FEMorphology
  • FEOffset
  • FESpecularLighting
  • FETile
  • FETurbulence
  • FENone

Add missing reference documentation

Ideally, each exported function would have a description as well as an example animation. Not all functions can be illustrated with an animation, though.

  • Reanimate.Animation.mkAnimation
  • Reanimate.Animation.adjustDuration (example missing)
  • Reanimate.Animation.setDuration (example missing)
  • Reanimate.Scene.sceneAnimation
  • Reanimate.Scene.adjustZ (example missing)
  • Reanimate.Scene.waitUntil (example missing)
  • Reanimate.Scene.withSceneDuration (example missing)
  • Reanimate.Effect.overBeginning (example missing)
  • Reanimate.Effect.overEnding (example missing)
  • Reanimate.Effect.overInterval (example missing)
  • Reanimate.Effect.reverseE (example missing)
  • Reanimate.Effect.delayE(example missing)
  • Reanimate.Effect.applyE (example missing)
  • Reanimate.Effect.constE (example missing)
  • Reanimate.Effect.fadeInE (example missing)
  • Reanimate.Effect.fadeOutE (example missing)
  • Reanimate.Effect.fadeLineInE (example missing)
  • Reanimate.Effect.fadeLineOutE (example missing)
  • Reanimate.Effect.drawInE (example missing)
  • Reanimate.Effect.drawOutE (example missing)
  • Reanimate.Effect.fillInE (example missing)
  • Reanimate.Effect.scaleE (example missing)
  • Reanimate.Effect.translateE (example missing)
  • Reanimate.Effect.aroundCenterE (example missing)
  • Reanimate.Povray.povray
  • Reanimate.Povray.povray'
  • Reanimate.Blender.blender
  • Reanimate.Blender.blender'
  • Reanimate.Constants.screenWidth
  • Reanimate.Constants.screenHeight
  • Reanimate.Constants.defaultStrokeWidth
  • Reanimate.Parameters.pFPS
  • Reanimate.Parameters.pHeight
  • Reanimate.Parameters.pWidth

Could find no file with path '/tmp/reanimate1799-0/render-%05d.png'

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

Problem with Hmatrix installation: Blas and Lapack

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.

Mesh smoothing

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.

Working
Numerical problems

These numerical problems can be avoided by smoothing the mesh inside of the polygon.

Tasks necessary for mesh smoothing:

  • Half-edge data structure.
  • Half-edge convenience functions:
    • Splitting edges.
    • Moving nodes.
    • Flipping edges.
  • Metrics:
    • Average angle.
    • Minimum angle.
    • Angle ratio.
    • Length ratio.
  • Mesh smoothing:
    • Laplacian.
    • Angle-based.
    • Delaunay edge-flips.
    • Edge splitting.

Benchmark render engines

  • Lots of small files.
  • Few large files.
  • External images.
  • Base64 encoded images.
  • SVG Filter Effects.
  • Low resolution.
  • High resolution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.