ShapeGeometry - Verge3D User Manual - Soft8Soft
Description: Learn how to use ShapeGeometry in your interactive 3D apps made with Verge3D

BufferGeometry →

# ShapeGeometry

Creates an one-sided polygonal geometry from one or more path shapes.

## Code Example

`const x = 0, y = 0; const heartShape = new v3d.Shape(); heartShape.moveTo(x + 5, y + 5); heartShape.bezierCurveTo(x + 5, y + 5, x + 4, y, x, y); heartShape.bezierCurveTo(x - 6, y, x - 6, y + 7,x - 6, y + 7); heartShape.bezierCurveTo(x - 6, y + 11, x - 3, y + 15.4, x + 5, y + 19); heartShape.bezierCurveTo(x + 12, y + 15.4, x + 16, y + 11, x + 16, y + 7); heartShape.bezierCurveTo(x + 16, y + 7, x + 16, y, x + 10, y); heartShape.bezierCurveTo(x + 7, y, x + 5, y + 5, x + 5, y + 5); const geometry = new v3d.ShapeGeometry(heartShape); const material = new v3d.MeshBasicMaterial({ color: 0x0000ff }); const mesh = new v3d.Mesh(geometry, material) ; app.scene.add(mesh);`

## Constructor

### ShapeGeometry(shapes : Array, curveSegments : Integer)

- shapes — array of shapes or a single shape. Default is a single triangle shape.
- curveSegments — number of segments per shape. Default is `12`.

Procedural geometry is fun. However, in real life applications this feature is rarely needed. It would be more efficient do design shape geometry in the preferred modelling suite and export/load to Verge3D via glTF.

## Properties

See the base BufferGeometry class for inherited properties.

### # .parameters : Object

An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.

## Methods

See the base BufferGeometry class for inherited methods.

## Source

For more info on how to obtain the source code of this module see this page.