

R is for Love - samartioli

# Paste into R then hit return<p># Start<p>draw = function(color="#FFC0CB",border="#FF0000") {<p><pre><code>    t = seq (0, 60, by = .1)

    x=-.01 * (-t^2 + 40*t + 1200) * sin(pi*t/180)

    y=.01 * (-t^2 + 40*t + 1200) * cos(pi*t/180)

    x=c(x,rev(.01 * (-t^2 + 40*t + 1200) * sin(pi*t/180)))

    y=c(y,rev(.01 * (-t^2 + 40*t + 1200) * cos(pi*t/180)))

    polygon(x,y, col=color, border=border)
</code></pre>
}<p>msgA="\x48\x61\x70\x70\x79\x20"<p>msgB="\x56\x61\x6c\x65\x6e\x74\x69\x6e\x65\x73\x20"<p>msgC="\x44\x61\x79\x20\x3a\x29"<p>msg=paste(msgA,msgB,msgC,sep='')<p>plot(c(-9,9), c(0,16), type="n", xlab=msg, ylab="", axes="FALSE")<p>i=1<p>paletteLength=50<p>q = c(colorRampPalette(c("#FFC0CB", "#FF0000"),bias = .1)( paletteLength ))<p>while(1) {<p><pre><code>    sleepTime = .01

    for (i in seq(1:paletteLength)) {

        draw(q[i],q[paletteLength+1-i])

        Sys.sleep(sleepTime)

    }

    for (i in rev(seq(1:paletteLength))) {

        draw(q[i],q[paletteLength+1-i])

        Sys.sleep(sleepTime)

    }
</code></pre>
}<p># End
======
samartioli
Sorry, initial post stripped newlines. Edited the post.. had to put 2 newlines
in order to maintain line breaks. (Tried <code> </code>.. didn't work.) Should
work now!

------
samartioli
download R: <http://www.r-project.org/>

