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

# ShapePath

This class is used to convert a series of shapes to an array of Paths, for example an SVG shape to a path. It is used internally by Font to convert a font in JSON format to a series of paths.

## Constructor

### ShapePath()

Creates a new ShapePath. Unlike a Path, no points are passed in as the ShapePath is designed to be generated after creation.

## Properties

### # .subPaths : Array

Array of Paths.

### # .currentPath : Array

The current Path that is being generated.

### # .color : Color

Color of the shape, by default set to white (`0xffffff`).

## Methods

### # .moveTo(x : Float, y : Float) → this

Starts a new Path and calls Path.moveTo(x, y) on that Path. Also points currentPath to that Path.

### # .lineTo(x : Float, y : Float) → this

This creates a line from the currentPath's offset to X and Y and updates the offset to X and Y.

### # .quadraticCurveTo(cpX : Float, cpY : Float, x : Float, y : Float) → this

This creates a quadratic curve from the currentPath's offset to x and y with cpX and cpY as control point and updates the currentPath's offset to x and y.

### # .bezierCurveTo(cp1X : Float, cp1Y : Float, cp2X : Float, cp2Y : Float, x : Float, y : Float) → this

This creates a bezier curve from the currentPath's offset to x and y with cp1X, cp1Y and cp2X, cp2Y as control points and updates the currentPath's offset to x and y.

### # .splineThru(points : Array) → this

points — an array of Vector2s

Connects a new SplineCurve onto the currentPath.

### # .toShapes(isCCW : Boolean) → Array

isCCW — changes how solids and holes are generated.

Converts the subPaths array into an array of Shapes. By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW). If isCCW is set to true, then those are flipped.

## Source

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