ease_aes | R Documentation |
Easing defines how a value change to another during tweening. Will it
progress linearly, or maybe start slowly and then build up momentum. In
gganimate
, each aesthetic or computed variable can be tweened with
individual easing functions using the ease_aes()
function. All easing
functions implemented in tweenr
are available, see tweenr::display_ease
for an overview. Setting an ease for x
and/or y
will also affect the
other related positional aesthetics (e.g. xmin
, yend
, etc).
ease_aes(default = "linear", ...)
default |
The default easing function to use (defaults to |
... |
Override easing for specific aesthetics |
quadratic Models a power-of-2 function
cubic Models a power-of-3 function
quartic Models a power-of-4 function
quintic Models a power-of-5 function
sine Models a sine function
circular Models a pi/2 circle arc
exponential Models an exponential function
elastic Models an elastic release of energy
back Models a pullback and relase
bounce Models the bouncing of a ball
Modifiers
-in The easing function is applied as-is
-out The easing function is applied in reverse
-in-out The first half of the transition it is applied as-is, while in the last half it is reversed
anim <- ggplot(mtcars, aes(mpg, disp)) +
transition_states(gear, transition_length = 2, state_length = 1) +
enter_fade() +
exit_fade()
## Not run:
# Default uses linear easing
animate(anim)
## End(Not run)
# Change all to 'cubic-in-out' for a smoother appearance
anim1 <- anim +
ease_aes('cubic-in-out')
## Not run:
animate(anim1)
## End(Not run)
# Only change easing of y variables
anim2 <- anim +
ease_aes(y = 'bounce-in')
## Not run:
animate(anim2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.