anim.smooth: Smooth an 'anim.frames' object

Description Usage Arguments Details Value Examples

View source: R/postprocessing.R

Description

Some export formats ignore information in the times attribute and plot frames at constant speed. anim.smooth creates a smoothed version of the anim.frames object with frames at constant intervals, suitable for export.

Usage

1
anim.smooth(x, fps = 10)

Arguments

x

an anim.frames object

fps

how many frames per second to smooth to

Details

Note that plot parameters such as x and y positions are not interpolated. If you want your whole animation to look smoother, you have to do the work yourself using e.g.approx.

If you smooth to a large value of fps, the animations may look bad in R because they overtax the graphics engine. They should still look good when saved, though.

Value

A smoothed anim.frames object, with the speed attribute equal to fps.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
accel <- anim.plot(1, 1:30, times=sqrt(1:30))
## Not run: 
anim.save(accel, "GIF", "wrong.gif")

## End(Not run)
accel <- anim.smooth(accel, fps=20)
## Not run: 
anim.save(accel, "GIF", "better.gif")

## End(Not run)

hughjonesd/anim.plots documentation built on May 5, 2021, 3:07 p.m.