[page:Path] →
[name]
Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with [page:ExtrudeGeometry],
[page:ShapeGeometry], to get points, or to get triangulated faces.
var heartShape = new THREE.Shape();
heartShape.moveTo( 25, 25 );
heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 );
heartShape.bezierCurveTo( 30, 0, 30, 35,30,35 );
heartShape.bezierCurveTo( 30, 55, 10, 77, 25, 95 );
heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 );
heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 );
heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 );
var extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 };
var geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
Examples
[example:webgl_geometry_shapes geometry / shapes ]
[example:webgl_geometry_extrude_shapes geometry / extrude / shapes ]
[example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2 ]
[example:webgl_particles_shapes particles / shapes ]
Constructor
[name]()
Properties
[property:array holes]
An array of [page:Path paths] that define the holes in the shape.
Methods
[method:ShapeGeometry makeGeometry]( [page:Object options] )
options -- This is passed as the second argument to [page:ShapeGeometry ShapeGeometry]
Convenience method to return ShapeGeometry
[method:Array extractAllPoints]( [page:Integer divisions] )
divisions -- The number of divisions to create on the shape
Get points of shape and holes (keypoints based on segments parameter)
[method:ExtrudeGeometry extrude]( [page:Object options] )
options -- This is passed as the second argument to [page:ExtrudeGeometry ExtrudeGeometry]
Convenience method to return ExtrudeGeometry
[method:Object extractPoints]( [page:Integer divisions] )
divisions -- The number of divisions to create on the shape
Returns an object with a *shape* and *holes* property that each reference an array of [page:Vector2 Vector2s].
[method:Object extractAllSpacedPoints]( [page:Integer divisions] )
divisions -- The number of divisions to create on the shape
Returns an object with a *shape* and *holes* property that each reference an array of [page:Vector2 Vector2s]. The
points will all be equally spaced along the shape.
[method:Array getPointsHoles]( [page:Integer divisions] )
divisions -- The number of divisions to create on the shape
Get an array of [page Vector2 Vector2s] that represent the holes in the shape.
[method:Array getSpacedPointsHoles]( [page:Integer divisions] )
divisions -- The number of divisions to create on the shape
Get an array of equally spaced [page Vector2 Vector2s] that represent the holes in the shape.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]