Closed rain1024 closed 9 years ago
I make a progress toward,
this below code worked :dancer:
---
output:
html_document:
keep_md: yes
---
```{r setup, results='asis'}
library(knitr)
knit_hooks$set(webgl = hook_webgl)
knit_hooks$set(rgl.static = hook_rgl) # use to capture a single rgl graphic
knit_hooks$set(rgl.mov = hook_plot_custom) # use to capture a movie
library(rgl)
library(animation)
for(i in 1:20){
x <- seq(0 + (1 * 0.05), 3 + (1 * 0.05), length= 20)
y <- x
f <- function(x, y) { sin(x * y) }
z <- outer(x, y, f)
persp(x, y, z, theta = 45, phi = i, expand = 0.4, col = "orange")
}
I discover a new thing, `knitr` will capture `persp` function and product animation move.
But I can find a way to make animation using `open3d` and `plot3d`
Please see the graphics manual: http://yihui.name/knitr/demo/graphics/ You need to explicitly save rgl graphics.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
I've had hard 2 days to find a completed example rgl animation with knitr.
Can you provide an completed example, such as animation for toss a 3d coin in rmarkdown?
Thank you so much.
This below code is not working