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

Add framework for animation options #18

Closed
wants to merge 18 commits into from

Conversation

gadenbuie
Copy link
Owner

This is an extension of #16 and that will help us move towards resolving #17.

It sets up a framework for creating, setting and transporting the animation options that may need to be passed through several helper functions to get to the final animate_plot() or static_plot() call.

It also lets

  1. The user set animation options for the current session, much like theme_set() in ggplot2
  2. Us create "default" animation options by verb family
  3. Us define or change the global defaults easily from one place.

I've created a more detailed explanation in this gist that also demonstrates some of the work from #16.

I'm bundling this as a PR to a PR in hopes that it's a little easier to review 😄

Note: somehow I ended up with duplicate commits because I tried to do something complicated with git locally. This PR should definitely be squash-merged into pkg-updates.

And demonstrates usage with the tidyr gather/spread animators. In essence, user-facing functions take an argument `anim_opts = anim_options()` as a last argument (after ... if applicable). These options should be passed through to lower level functions and should be given to `animate_plot()` and `static_plot()`.

This implementation actually doesn't break previous functions, but the join and set families will need to be updated to match.
And update documentation for both options
Set option "tidyexplain.strict_dots" to TRUE for checking for issues with extra arguments being passed in ... to the _plot() functions.
ggproto objects like those created by enter_fade() or exit_appear() evaluate to enviroments making it impossible to compare two ggproto objects to determine if they are the same (both will be different environments). To get around this, I store the expression used to create the enter/exit arguments so that we can later compare two objects created by anim_options().
Lets us define default animation options by animation family that can be overridden by the user at runtime. Demonstration of usage with animate_gather() and animate_spread()
- Sets global defaults in plot_settings environment
- Adds ability to set animation options, similar to theme_set() from ggplot2
- Adds getters for current (if set) or default animation options

Merge branch 'pkg-add-anim-options' into pkg-add-anim-options-merge
And demonstrates usage with the tidyr gather/spread animators. In essence, user-facing functions take an argument `anim_opts = anim_options()` as a last argument (after ... if applicable). These options should be passed through to lower level functions and should be given to `animate_plot()` and `static_plot()`.

This implementation actually doesn't break previous functions, but the join and set families will need to be updated to match.
And update documentation for both options
Set option "tidyexplain.strict_dots" to TRUE for checking for issues with extra arguments being passed in ... to the _plot() functions.
ggproto objects like those created by enter_fade() or exit_appear() evaluate to enviroments making it impossible to compare two ggproto objects to determine if they are the same (both will be different environments). To get around this, I store the expression used to create the enter/exit arguments so that we can later compare two objects created by anim_options().
- Collected in animate_options.R
- Sets global defaults in plot_settings environment
- Adds ability to set animation options, similar to theme_set() from ggplot2
- Adds getters for current (if set) or default animation options

Merge branch 'pkg-add-anim-options-merge' into pkg-add-anim-options

# Conflicts:
#	NAMESPACE
#	R/animate_tidyr.R
#	R/plot_helpers.R
#	man/anim_options.Rd
#	man/animate_gather.Rd
#	man/animate_spread.Rd
#	man/static_plot.Rd
@gadenbuie
Copy link
Owner Author

I fixed the commit history in the new PR #19

@gadenbuie gadenbuie closed this Sep 4, 2018
@gadenbuie gadenbuie deleted the pkg-add-anim-options branch September 4, 2018 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant