# \donttest{
rgl.new(aspect=4/3, col='black', xlim=c(-4,4), ylim=c(-4,4), zlim=c(-4,4))
rgl::clear3d(type = "lights")
rgl::light3d(30,60,viewpoint.rel = FALSE)
# }
# Make frame function
frame = function(t) {
# t = time in seconds
rgl.hold()
if (t>0) {for (i in seq(3)) rgl::pop3d()}
rgl.ball(0, 0, 0, 1, normals='improved', depth=6, png=system.file('earth.png', package='rglplus'),
emission='#444466', rotation=rgl::rotationMatrix(t/86400*2*pi,0,0,1))
alpha = seq(0,2*pi,length=360)+2*pi*t/43200
alpha = c(alpha[1],rep(alpha[2:359],each=2),alpha[360])
y = 3.168*cos(alpha)
z = 3.168*sin(alpha)
rgl.ball(0,y[1],z[1],0.05,col='red',emission='#aa0000')
rgl::segments3d(0,y,z,col='red',alpha=seq(0,1,length=720))
rgl.draw()
}
# Make path
path = list(position=c(10,10,0), up=c(0,0.5,1), fov = function(t) 40-t/8640)
# Produce movie
if (FALSE) {
rgl.makemovie(frame=frame, path=path, tmin=0, tmax=86400, output.path='~/testmovie',
output.filename = 'movie.mp4', ffmpeg.cmd = 'ffmpeg', nframes=600)
}
Run the code above in your browser using DataLab