I am creating a "textbook" using R Markdown. What a fantastic resource!
It works really well (so far!), but I have two questions (I will post one here, and one in a new thread).
My second question: I would really like to include animations.I have been using the
animation package, and can successfully create animations using
saveHTML()... and they look super.
I can include the GIF into my bookdown document using
knitr::include_graphics(path="./Animations/Animation.gif"), where I have created the GIF in the `Animations directory. But, as the help suggests, this has limitations, and the HTML is better.
But how to I embed the HTML animation into my bookdown document? Again, I can create the HTML animation (in the
Animations directory, along with all the associated files), and I can get it to appear in my bookdown document using this inside a chunk:
htmltools::tags$iframe(title = "Embedded HTML", src = "./Animations/Animation.html", height=800, width=800)
But there are two issues I can see.
The main issue is that I need to specify the
The second issue is that I would like to be able to reference this animation, as a figure (as I do successfully with all the other figures in the document). But that doesn't seem to work within a chunk using
fig.cap="caption text". Likewise, the
fig.align="center" doesn't center the animation either.
It probably suggests that i am doing things the wrong way.
So: After generating the HTML animation, what is the best way to embed said HTML animation in my bookdown document? (Of course, I am thinking of HTML output.)
PS: I prefer base graphics. Old dog; new tricks, etc.