Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enter_* and exit_* not working with transition_reveal() or transition_time() #445

Open
mccarthy-m-g opened this issue Jun 26, 2021 · 3 comments
Labels

Comments

@mccarthy-m-g
Copy link

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 and exit 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)

@mgei
Copy link

mgei commented Sep 24, 2022

Using gganimate 1.0.8, the text does not appear at day 20 anymore (instead it shows briefly at the end of the animation).

@thomasp85
Copy link
Owner

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

@mccarthy-m-g
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants