library(knitr) opts_chunk$set( fig.path='./figs/kn',concordance=TRUE )
options(width=70) library(animatoR) library(knitr)
This is a short example to show how to embed animatoR
based animations
into Rmarkdown generated HTML file.
For embedding we can use the figure chunk option
fig.show='animate'
.
Option interval
controls the smoothness of
the replay.
Size is set by the option out.width
.
Here are the chunk options used for this example
{fig.show='animate',interval=0.01,results="asis"}
animator( "newplot();box();tpoints(2,2,8,8,cex=2,pch=16)" ,life=2)
To view and run the animation, you have to open the HTML file in a browser.
cat(win.version()) sessionInfo() cat("Project path:`",dirname(getwd()),"`\\\\\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.