I was trying to plot many frames and target the output to be a certain length (5 seconds):
nn = 720L
saveGIF({for (ii in 1:nn) plot(1:10)}, interval = 5/nn)
Error in if (100%%fps) stop("argument 'fps' must be a factor of 100") :
argument is not interpretable as logical
Quite strange. However, the stack trace gives a lot clearer understanding:
4: magick::image_animate(img, loop = loop, fps = 100/as.integer(interval *
100), dispose = dispose)
3: magick.convert(files = files, output = output, loop = loop, interval = interval,
dispose = dispose)
2: im.convert(img.files, output = path.expand(movie.name), convert = convert,
cmd.fun = cmd.fun, clean = clean, extra.opts = extra.opts)
1: saveGIF({
for (ii in seq_along(grd)) {
t = grd[ii]
par(oma = c(0.1, 0.1, 0.1, 0.1))
plot(NA, xlim = c(-e, e), ylim = c(-e, e), asp = 1, axes = FALSE,
xlab = "", ylab = "")
lines(a * cos(grd), a * sin(grd), lty = 2L)
x0 = a * cos(t)
y0 = a * sin(t)
segments(0, 0, x0, y0)
lines(x0 + b * cos(grd), y0 + b * sin(grd), lty = 3L)
points(a * cos(t) - b * sin(t), a * sin(t) + b * cos(t),
pch = 19L, col = "red")
segments(x0, y0, x0 + b * cos(t + pi/2), y0 + b * sin(t +
pi/2))
lines(r * cos(grd[1:ii] - t0), r * sin(grd[1:ii] - t0))
}
}, interval = 5/nn)
100/as.integer(interval * 100)
I was trying to plot many frames and target the output to be a certain length (5 seconds):
This then failed:
Quite strange. However, the stack trace gives a lot clearer understanding:
In particular:
Will give
Infsinceinterval < 1/100soas.integerwill truncate to 0.It would be helpful if this were pointed out sooner