Sphere
The sphere() function creates a 3D sphere. You can set the radius and adjust segment counts
for smoothness.
sphere(40) .color("skyblue") .shaded();
Returns the Sphere object:
Sphere
Example usage:
sphere.radius(1.5).color("cornflowerblue");
field
mesh: THREE.Mesh<THREE.SphereGeometry>
The THREE.Mesh instance representing this object.
Example
sphere.mesh.rotation.y = Math.PI / 6;
method
pos(position: Vec3): Sphere
Set the position of the object.
param position
A vector-like object representing the position.Example
sphere.pos([0, 1, 0]);
method
color(color: THREE.ColorRepresentation): Sphere
Set the color of the object.
param color
A color input for this object.Example
sphere.color("skyblue");
method
material(material: THREE.Material): Sphere
Set the material of the object.
param material
A THREE.Material instance.Example
sphere.material(new THREE.MeshStandardMaterial());
method
shaded(): Sphere
Configures the object to use a shaded material.
Example
sphere.shaded();
method
radius(radius: number): Sphere
Sets the radius of the sphere.
param radius
The new radius of the sphere.Example
sphere.radius(2);
method
segments(widthSegments: number, heightSegments: number): Sphere
Sets the number of width and height segments of the sphere.
param widthSegments
Width segmentsparam heightSegments
Height segmentsExample
sphere.segments(32, 16);