I want to slow the transition speed between states when using library(gganimate)
.
Here is a mini example:
# devtools::install_github("thomasp85/gganimate")
library(gganimate) # v0.9.9.9999
dat_sim <- function(t_state, d_state) {
data.frame(
x = runif(1000, 0, 1),
y = runif(1000, 0, 1),
t_state = t_state*d_state
)
}
dat <- purrr::map_df(1:100, ~ dat_sim(., 1))
ggplot(dat, aes(x, y)) +
geom_hex(bins = 5) +
theme_void() +
lims(x = c(.3, .7),
y = c(.3, .7)) +
theme(legend.position = "none") +
transition_time(t_state)
My ideal behavior would be much slower (10-100x), so color changes gradually evolve and nobody has a seizure.
If I try to use transition_states()
for more manual control, I get a gif with mostly blank frames. I've tried various combinations for transition_legnth=
and state_length=
without a noticeable effect.
ggplot(dat, aes(x, y)) +
geom_hex(bins = 5) +
theme_void() +
lims(x = c(.3, .7),
y = c(.3, .7)) +
theme(legend.position = "none") +
transition_states(t_state, transition_length = .1, state_length = 2)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…