library(knitr)
library(svglite)

local({
  knit_hooks$set(plot = function(x, options) {
    paste(readLines(x), collapse = '\n')
  })
  
  opts_chunk$set(
    dev = "svglite",
    dev.args = list(standalone = FALSE),
    fig.ext = ".svg"
  )
})
library(ggplot2)

ggplot(economics_long, aes(date, value01, colour = variable)) +
  geom_line()
0.00 0.25 0.50 0.75 1.00 1970 1980 1990 2000 2010 date value01 variable pce pop psavert uempmed unemploy

I added this CSS:

polyline {
  stroke-dasharray: 50;
  animation: dash 10s linear;
}

@keyframes dash {
  to {
    stroke-dashoffset: 2000;
  }
}