# Examples from pyvista.Plotter.orbit_on_path
# ===========================================

# Plot an orbit around the earth.  Save the gif as a temporary file.
from pathlib import Path
from tempfile import mkdtemp
import pyvista as pv
from pyvista import examples
mesh = examples.load_globe()
texture = examples.load_globe_texture()
filename = Path(mkdtemp()) / 'orbit.gif'
pl = pv.Plotter(window_size=[300, 300])
_ = pl.add_mesh(mesh, texture=texture, smooth_shading=True)
pl.open_gif(filename)
viewup = [0, 0, 1]
orbit = pl.generate_orbital_path(
    factor=2.0, n_points=24, shift=0.0, viewup=viewup
)
pl.orbit_on_path(orbit, write_frames=True, viewup=viewup, step=0.02)

# See Orbiting for a full example using this method.

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

