shadow_trail: A trail of evenly spaced old frames

Description Usage Arguments See Also Examples

View source: R/shadow-trail.R

Description

This shadow will trace the movement in your animation by keeping every nth frame and will thus produce a breadcrumb-like trail. Note that the shadow frames will not be equidistant in space but in time (that is, if a point moves slowly the crumbs will be closer to each other). It is possible to modify the look of the shadow by changing the different graphic parameters in the data

Usage

1
shadow_trail(distance = 0.05, max_frames = Inf, ..., exclude_layer = NULL)

Arguments

distance

The temporal distance between the frames to show, as a fraction of the full animation length

max_frames

The maximum number of shadow frames to show

...

changes to the shadow data, e.g. alpha = alpha/2 or colour = 'grey'

exclude_layer

Indexes of layers that should be excluded.

See Also

Other shadows: shadow_mark(), shadow_null(), shadow_wake()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
anim <- ggplot(airquality, aes(Day, Temp, colour = factor(Month))) +
  geom_point() +
  transition_time(Day)

# Change distance between points
anim1 <- anim +
  shadow_trail(0.02)

# Style shadow differently
anim2 <- anim +
  shadow_trail(alpha = 0.3, shape = 2)

# Restrict the shadow to 10 frames
anim3 <- anim +
  shadow_trail(max_frames = 10)

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