Comments (6)
Actually, the new magick package may be better approach
from rchess.
Hi @pssguy
Tell me if this looks good to you.
library("magick")
get_gif <- function(pgn, scale = "400x400", fps = 1) {
fens <- get_fens(pgn)
# fens <- head(fens)
fens %>%
map(ggchessboard) %>%
map_chr(function(p){ # p <- sample(plots, size = 1)[[1]]
fl <- tempfile(fileext = ".jpg")
ggplot2::ggsave(p, file = fl)
fl
}) %>%
image_read() %>%
image_scale(geometry = scale) %>%
image_animate(fps = fps)
}
gif <- get_gif(pgn)
image_write(gif, "anim.gif")
I need to change the font to have a nicer look but is a start.
I you're ok I will proceed to add this utilities into the package! :B
from rchess.
This is amazing work
Any reason you chose jpg over png?
Currently it is set to fps=1. I found 0.2 gave me time to take in moves better (same file size)
Ideally, somehow for users there would be controls to pause, set speed etc. but I have no idea if this is even feasible
from rchess.
No reason, just copy paste code from somewhere.
Not sure yet too how to implement parameters for have control in the image_animate
. I'll take some time to see if this is feasible in a simple way.
from rchess.
What about plotting this animation in R-Studio? So not saving as a file but real time plot a game. I cannot do it, as the plot won't refresh in a for loop. How to solve this?
from rchess.
I guess it's possible wrap the image in a html div using htmltools package and then use the browseable function to send it to the viewer.
Let me if you can try this idea.
from rchess.
Related Issues (14)
- Get captured material
- get_header funcionality HOT 1
- Bug in history_detail HOT 2
- simultaneous castling and check HOT 1
- Can't load pgn! HOT 3
- Implement a chess engine HOT 2
- Adding chessboard themes
- Enhancement Request: plot after specific move HOT 6
- Unclear why this is an invalid move HOT 2
- Input moves via shiny? HOT 2
- Build Fail HOT 1
- wrong pgn in the chessopenings dataset
- plot problem on google colab
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rchess.