title: Gradually change colour of polygon with gganimate
body: <p>I'm trying to create an animation where an object is drawn whilst gradually changing its colour. For illustrative purposes assume that the object I want to draw is a circle.</p>
  <p><strong>What I have so far</strong></p>
  <p>I create a dataset that contains the coordinates of my circle, a <code>time</code> variable and a <code>alpha</code> variable for gradually changing the colour:</p>
  <pre><code>t = seq(-pi, pi, length.out = 30)
  df &lt;- data.frame(
    x = sin(t), 
    y = cos(t), 
    time = 1:30, 
    alpha = seq(0.1, 1, length.out = 30)
  )
  </code></pre>
  <p>Then I use <code>transition_reveal()</code> from {gganimate} to make the animation:</p>
  <pre><code>ggplot(df, aes(x = x, y = y)) + 
    geom_path() +
    geom_polygon(aes(alpha = alpha), fill = 'grey30') +
    coord_fixed() +
    scale_alpha_identity() +
    transition_reveal(time)
  </code></pre>
  <p>Which yields the following animation:</p>
  <p><a href="https://i.stack.imgur.com/zuIkt.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zuIkt.gif" alt="gif that draws a circle" /></a></p>
  <p>The circle is drawn sequentially (which is what I want), but the colour of the polygon does not change. It appears that only the first value of <code>df$alpha</code> is used for the whole animation.</p>
  <p><strong>My question is thus</strong> how can I change this animation such that the circle is still drawn sequentially <strong>AND</strong> the colour of the polygon gradually becomes greyer?</p>