File: Xmas.R

package info (click to toggle)
r-cran-animation 2.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,268 kB
  • sloc: javascript: 873; sh: 15; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 491 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Merry Xmas 2009!
# see: http://yihui.org/en/2009/12/merry-christmas-using-r/
n = length(speed <- runif(angle <- runif(
  x <- strsplit('MERRY CHRISTMAS', '')[[1]], 0, 360), 0, 15))
x11(width = 10, height = 3)
par(mar = rep(0, 4), bg = 'black')
for (j in 1:1000) {
  angle = angle + speed
  dev.hold()
  plot.new()
  plot.window(c(1, n), c(0, 1))
  for (i in 1:n) text(i, 0.5, x[i], srt = angle[i],
                      cex = runif(1, 1, 4), col = sample(colors(), 1))
  ani.pause(0.02)
}