View source: R/postprocessing.R
| anim.smooth | R Documentation |
anim.frames objectSome 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.
anim.smooth(x, fps = 10)
x |
an |
fps |
how many frames per second to smooth to |
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.
A smoothed anim.frames object, with the speed attribute equal
to fps.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.