Note that ViewPoint
is given in specially scaled coordinates which depend on amongst things the size of the bounding box. To get better control over the positioning of the camera you could use ViewVector
instead, which is given in terms of the coordinates of the plot. You could for example do something like this:
rotateMeHarder1[g_, vertical_, viewpoint0_, center_List: {0, 0, 0},
nframes_Integer: 15, opts : OptionsPattern[]] := Module[{grlist},
grlist =
Table[Show[g, ViewVertical -> vertical,
ViewVector -> {RotationMatrix[2 Pi/nframes i,
vertical].(viewpoint0 - center) + center, center},
SphericalRegion -> True, opts], {i, 0, nframes - 1}]]
where g
is the Graphics3D
object, vertical
is the vertical axis, viewpoint0
is the starting position of the camera, center
is the center of the graph, nframes
is the number of frames, and opts
are additional options of the graph.
Usage
To create an animation of the plot p
in the original question rotating around the axis anchored at {10, 0, 0}
and direction {0, 1, 0}
, and initial camera position {30, 30, 30}
you could do something like
p = SphericalPlot3D[10 + 5*Re@ SphericalHarmonicY[3, -3, \[Theta]θ, \[Phi]]ϕ],
\[Theta]θ, \[Phi]ϕ, Boxed -> False, Axes -> True,
AxesOrigin -> {0, 0, 0}, AxesStyle -> {{Thick, Red}, {Thick, Green}, {Thick, Blue}},
Ticks -> None, PlotStyle -> Opacity[0.7]];
grlist = rotateMeHarder1[p, {0, 1, 0}, {30, 30, 30}, {10, 0, 0}, 20,
ViewAngle -> 50 Degree]
ListAnimate[grlist]
Note that I'm using ViewAngle
to adjust the size of the graphics relative to the viewing area. By increasing the ViewAngle
you effectively zoom out and vice versa. Another option to change the relative size of the graphics would be to change the distance of the initial camera position to the axes of rotation.
You can use Export
to create an animated .gif or other type of movie, e.g.
Export["movie.gif", grlist];
This solution requires some manual tuning especially in choosing the initial view vector and the view angle. You could for example use Manipulate
to experiment with values for these parameters.