anim.plots (version 0.2)

anim.smooth: Smooth an anim.frames object

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

anim.smooth(x, fps = 10)

Arguments

x

an anim.frames object

fps

how many frames per second to smooth to

Value

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

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.

Examples

Run this code
# NOT RUN {
accel <- anim.plot(1, 1:30, times=sqrt(1:30))
# }
# NOT RUN {
anim.save(accel, "GIF", "wrong.gif")
# }
# NOT RUN {
accel <- anim.smooth(accel, fps=20)
# }
# NOT RUN {
anim.save(accel, "GIF", "better.gif")
# }

Run the code above in your browser using DataCamp Workspace