ease_aes: Control easing of aesthetics

Description Usage Arguments Easing functions Examples

View source: R/ease-aes.R

Description

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).

Usage

1
ease_aes(default = "linear", ...)

Arguments

default

The default easing function to use (defaults to 'linear')

...

Override easing for specific aesthetics

Easing functions

Modifiers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)

gganimate documentation built on Oct. 23, 2020, 8:04 p.m.