Sphere#

Qualified name: manim.mobject.three\_d.three\_dimensions.Sphere

class Sphere(center=array([0., 0., 0.]), radius=1, resolution=None, u_range=(0, 6.283185307179586), v_range=(0, 3.141592653589793), **kwargs)[source]#

Bases: Surface

An three-dimensional sphere.

Parameters
  • center – Center of the Sphere.

  • radius – The radius of the Sphere.

  • resolution – The number of samples taken of the Sphere. A tuple can be used to define different resolutions for u and v respectively.

  • u_range – The range of the u variable: (u_min, u_max).

  • v_range – The range of the v variable: (v_min, v_max).

Examples

Example: ExampleSphere

../_images/ExampleSphere-1.png
from manim import *

class ExampleSphere(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=PI / 6, theta=PI / 6)
        sphere1 = Sphere(
            center=(3, 0, 0),
            radius=1,
            resolution=(20, 20),
            u_range=[0.001, PI - 0.001],
            v_range=[0, TAU]
        )
        sphere1.set_color(RED)
        self.add(sphere1)
        sphere2 = Sphere(center=(-1, -3, 0), radius=2, resolution=(18, 18))
        sphere2.set_color(GREEN)
        self.add(sphere2)
        sphere3 = Sphere(center=(-1, 2, 0), radius=2, resolution=(16, 16))
        sphere3.set_color(BLUE)
        self.add(sphere3)

Methods

func

Attributes

animate

Used to animate the application of any method of self.

animation_overrides

color

depth

The depth of the mobject.

fill_color

If there are multiple colors (for gradient) this returns the first one

height

The height of the mobject.

n_points_per_curve

sheen_factor

stroke_color

width

The width of the mobject.