In knitr, there is a hook for creating animation with javascript:
hook_scianimator
However, if you directly use it with pandoc and slidy, the animation
will not be correctly rendered. The reason is that the .html created by pandoc
will not include the source scianimator required.
Yesterday, I successfully intergrate scianimator into slidy.
Environment
- Ubuntu 12.04 and ubuntu 12.10
- pandoc1.10.0.4
- R2.15.2
- knitr1.0.5
Hacks
- Download the zip file from Scianimator
- Copy the subdirectory assetsunder your project.
- Copy the original template used by pandoc,/<path to pandoc>/data/templates/default.slidy, toslidy/slidy.scianimator
- add the following line:
from:
html origin   ...   <script src="$slidy-url$/scripts/slidy.js.gz"     charset="utf-8" type="text/javascript"></script>   ...
to:
html origin   ...   <script src="$slidy-url$/scripts/slidy.js.gz"     charset="utf-8" type="text/javascript"></script>   <script src="assets/js/jquery-1.4.4.min.js"></script>   <script src="assets/js/jquery.scianimator.pack.js"></script>   <script src="assets/js/jquery.scianimator.js"></script>   <script src="assets/js/index.js"></script>   ...
- Use the following pandoc arguments:
pandoc -s -S -i -t slidy --template=slidy/slidy.scianimator --mathjax src.md -o target.htmlThat’s it!