Cylinder

The cylinder() function creates a 3D cylinder. Set top and bottom radius plus the height to get straight or tapered shapes.

cylinder(40, 40, 80)
    .pos([-70, 0])
    .color("teal")
    .shaded();

cylinder(20, 40, 80)
    .pos([70, 0])
    .color("crimson")
    .shaded();

Returns the Cylinder object:


Cylinder

Example usage:
cylinder.height(2).radiusTop(1).radiusBottom(0.5);
field
mesh: THREE.Mesh<THREE.CylinderGeometry>
The THREE.Mesh instance representing this object.
Example
cylinder.mesh.rotation.x = Math.PI / 6;
method
pos(position: Vec3): Cylinder
Set the position of the object.
param position
A vector-like object representing the position.
Example
cylinder.pos([0, 1, 0]);
method
color(color: THREE.ColorRepresentation): Cylinder
Set the color of the object.
param color
A color input for this object.
Example
cylinder.color("teal");
method
material(material: THREE.Material): Cylinder
Set the material of the object.
param material
A THREE.Material instance.
Example
cylinder.material(new THREE.MeshStandardMaterial());
method
shaded(): Cylinder
Configures the object to use a shaded material.
Example
cylinder.shaded();
method
radiusTop(radiusTop: number): Cylinder
Sets the top radius of the cylinder.
param radiusTop
The new top radius of the cylinder.
Example
cylinder.radiusTop(1);
method
radiusBottom(radiusBottom: number): Cylinder
Sets the bottom radius of the cylinder.
param radiusBottom
The new bottom radius of the cylinder.
Example
cylinder.radiusBottom(1.5);
method
height(height: number): Cylinder
Sets the height of the cylinder.
param height
The new height of the cylinder.
Example
cylinder.height(3);
method
segments(segments: number): Cylinder
Sets the number of radial segments of the cylinder.
param segments
The new number of radial segments.
Example
cylinder.segments(24);