[page:CurvePath] →
[name]
A 2d path representation, comprising of points, lines, and cubes, similar to the 2D Canvas API.
It extends [page:CurvePath].
Example
var v1 = new THREE.Vector3();
var v2 = new THREE.Vector3(1, 45, 6);
var v3 = new THREE.Vector3(34, 34, 676);
var vectors = [v1, v2, v3];
var path = new THREE.Path(vectors);
Constructor
[name]( [page:Array points] )
points -- (optional) array of [page:Vector2 Vector2s].
Creates a Path from the points. The first point defines the offset, then successive points
are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].
If no points are specified, an empty path is created and the [page:.currentPoint] is set to
the origin.
Properties
See the base [page:CurvePath] class for common properties.
[property:array currentPoint]
The current offset of the path. Any new [page:Curve] added will start here.
Methods
See the base [page:CurvePath] class for common methods.
[method:null absarc]( [page:Float x], [page:Float y], [page:Float radius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise] )
x, y -- The absolute center of the arc.
radius -- The radius of the arc.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the arc clockwise. Defaults to *false*.
Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.
[method:null absellipse]( [page:Float x], [page:Float y], [page:Float xRadius], [page:Float yRadius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise], [page:Float rotation] )
x, y -- The absolute center of the ellipse.
xRadius -- The radius of the ellipse in the x axis.
yRadius -- The radius of the ellipse in the y axis.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the ellipse clockwise. Defaults to false.
rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to 0.
Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.
[method:null arc]( [page:Float x], [page:Float y], [page:Float radius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise] )
x, y -- The center of the arc offset from the last call.
radius -- The radius of the arc.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the arc clockwise. Defaults to *false*.
Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].
[method:null bezierCurveTo]( [page:Float cp1X], [page:Float cp1Y], [page:Float cp2X], [page:Float cp2Y], [page:Float x], [page:Float y] )
This creates a bezier curve from [page:.currentPoint] with (cp1X, cp1Y) and (cp2X, cp2Y) as control points and updates [page:.currentPoint] to x and y.
[method:null fromPoints]( [page:Array vector2s] )
points -- array of [page:Vector2 Vector2s].
Adds to the from the points. Points are added to the [page:CurvePath.curves curves]
array as [page:LineCurve LineCurves].
[method:null ellipse]( [page:Float x], [page:Float y], [page:Float xRadius], [page:Float yRadius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise], [page:Float rotation] )
x, y -- The center of the ellipse offset from the last call.
xRadius -- The radius of the ellipse in the x axis.
yRadius -- The radius of the ellipse in the y axis.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the ellipse clockwise. Defaults to *false*.
rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to *0*.
Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].
[method:null lineTo]( [page:Float x], [page:Float y] )
Connects a [page:LineCurve] from [page:.currentPoint] to x, y onto the path.
[method:null moveTo]( [page:Float x], [page:Float y] )
Move the [page:.currentPoint] to x, y.
[method:null quadraticCurveTo]( [page:Float cpX], [page:Float cpY], [page:Float x], [page:Float y] )
Creates a quadratic curve from [page:.currentPoint] with cpX and cpY as control point and updates [page:.currentPoint] to x and y.
[method:null splineThru] ( [page:Array points] )
points - An array of [page:Vector2 Vector2s]
Connects a new [page:SplineCurve] onto the path.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]