enter_* and exit_* not working with transition_reveal() or transition_time()
mccarthy-m-g opened this issue · 3 comments
Thanks for making this package, I've been exploring it in a blog post I'm working on and it's really great! Quick question:
Do the enter
and exit
functions work with transition_reveal()
and transition_time()
?
Other transition_*
functions have examples including the use of the enter
and exit
functions working with them, but transition_reveal()
and transition_time()
do not. After trying (and failing) to get enter_fade()
working in a transition_reveal()
animation I'm wondering if the absence in the examples is because enter
and exit
functions do not work with transition_reveal()
and transition_time()
.
The use case I'm going for is to have an annotation made with geom_text()
fade into the animation rather than instantly appearing. The Getting Started article on the pkgdown website states that:
enter
andexit
functions are used to modify the aesthetics of appearing and disappearing data so that their entrance or exit may be animated.
But this does not seem to apply for data that appears or disappears in transition_reveal()
and transition_time()
. Here's a reprex demonstrating this. I consider the data from geom_text()
to be "appearing" on day 20 and expect the fade in to apply to it, but instead it appears instantly.
library(gganimate)
#> Loading required package: ggplot2
anim <- ggplot(airquality, aes(Day, Temp)) +
geom_line(aes(group = Month)) +
geom_text(
data = data.frame(Day = as.integer(20)),
aes(x = 20, y = 95, group = Day),
label = "It's day 20!"
) +
transition_reveal(Day) +
enter_fade("text") # This seems to do nothing
anim
Created on 2021-06-26 by the reprex package (v2.0.0)
Using gganimate 1.0.8, the text does not appear at day 20 anymore (instead it shows briefly at the end of the animation).
enter and exit sadly doesn't work with transition_reveal()
for some technical reasons. I've long wondered how to make it work without finding a good solution. It should work with transition_time()
though
Ah, that’s too bad. Would you be able to document what does/doesn’t work together somewhere? (maybe a table in the README, or if this is an outlier maybe just a note in the function documentation)