I'm trying to work on an animation for an upcoming presentation but have hit a bit of a wall. What I'm trying to do is have gganimate draw lines for several species, one after the other, and once a line has finished being drawn have it either fade or change to gray so the new lines are more obvious. I've gotten the first part of that working fine (see example below) but can't seem to figure out a way to make the lines fade. I tried looking around but couldn't find any other solutions posted anywhere.
library(tidyverse)
library(gganimate)
# Create some data
year <- rep(c(1:10),2)
type <- c(rep(c("A"),10), rep(c("B"),10))
count <- floor(runif(20,1,15))
df <- data.frame(year, type, count)
# Creat index variable for animation
df$index <- 1:nrow(df)
ggplot(df, aes(x = as.factor(year), y = count, color = type)) +
geom_line(aes(group = type),
lwd = 1) +
transition_reveal(index)