ShapePath.html.md 2.6 KB

ShapePath

This class is used to convert a series of paths to an array of shapes. It is specifically used in context of fonts and SVG.

Constructor

new ShapePath()

Constructs a new shape path.

Properties

.color : Color

The color of the shape.

.currentPath : Path

The current path that is being generated.

Default is null.

.subPaths : Array.

The paths that have been generated for this shape.

Default is null.

.userData : Object

An object that can be used to store custom data about the shape path. Mainly used by SVGLoader to store style information.

Methods

.bezierCurveTo( aCP1x : number, aCP1y : number, aCP2x : number, aCP2y : number, aX : number, aY : number ) : ShapePath

Adds an instance of CubicBezierCurve to the path by connecting the current point with the given one.

aCP1x

The x coordinate of the first control point.

aCP1y

The y coordinate of the first control point.

aCP2x

The x coordinate of the second control point.

aCP2y

The y coordinate of the second control point.

aX

The x coordinate of the end point.

aY

The y coordinate of the end point.

Returns: A reference to this shape path.

.lineTo( x : number, y : number ) : ShapePath

Adds an instance of LineCurve to the path by connecting the current point with the given one.

x

The x coordinate of the end point.

y

The y coordinate of the end point.

Returns: A reference to this shape path.

.moveTo( x : number, y : number ) : ShapePath

Creates a new path and moves it current point to the given one.

x

The x coordinate.

y

The y coordinate.

Returns: A reference to this shape path.

.quadraticCurveTo( aCPx : number, aCPy : number, aX : number, aY : number ) : ShapePath

Adds an instance of QuadraticBezierCurve to the path by connecting the current point with the given one.

aCPx

The x coordinate of the control point.

aCPy

The y coordinate of the control point.

aX

The x coordinate of the end point.

aY

The y coordinate of the end point.

Returns: A reference to this shape path.

.splineThru( pts : Array. ) : ShapePath

Adds an instance of SplineCurve to the path by connecting the current point with the given list of points.

pts

An array of points in 2D space.

Returns: A reference to this shape path.

.toShapes() : Array.

Converts the paths into an array of shapes.

Returns: An array of shapes.

Source

src/extras/core/ShapePath.js

粤ICP备19079148号