anim.curve {anim.plots}R Documentation

Draw an animated curve.

Description

This function is the animated version of curve.

Usage

anim.curve(expr, x = NULL, from = 0, to = 1, n = 255, times, type = "l", ...)

Arguments

expr

a function which takes two arguments, or an expression involving x and t.

x

values of x at which the function will be evaluated in each frame. Alternatively, you may specify from, to and n.

from, to

endpoints of x

n

number of values of x at which the function will be evaluated for each frame

times

vector of values of t at which the function will be evaluated. Each unique value creates a single animation frame.

type, ...

parameters passed to anim.plot.default

Details

Note that times is interpreted differently here than elsewhere. In particular, it cannot be a length-1 vector.

Examples

anim.curve(x^t, times=10:50/10, n=20)
anim.curve(sin(x*t), times=1:30, n=100, speed=12, col="darkgreen", from=-1, to=1)

## curve is constant in t, but window moves. 
## NB: 'from' and 'to' control where the expression is evaluated. 
## 'xlim' just controls the window.
anim.curve(sin(cos(-x)*exp(x/2)), times=0:100/10, from=-5, to=10, n=500, 
     col="red", lwd=2, xlim=rbind(top <- seq(-5, 10, 1/10), top+5))

[Package anim.plots version 0.2.2 Index]