Class Index | File Index

Classes


Class CAAT.PathUtil.Path


Extends CAAT.PathUtil.PathSegment.

Defined in: Path.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
starting path x position
 
starting path y position
 
A list of behaviors to apply to this path.
 
Path bounding box X position.
 
Path bounding box Y position.
 
Is this path closed ?
 
Path bounding box height.
 
Is this path interactive ?.
 
Path behaviors matrix.
 
spare CAAT.Math.Point to return calculated values in the path.
 
path length (sum of every segment length)
 
Original Path´s path segments points.
 
For each path segment in this path, the normalized calculated duration.
 
A collection of PathSegments.
 
For each path segment in this path, the normalized calculated start time.
 
Path rotation angle.
 
Path rotation x anchor.
 
Path rotation x anchor.
 
Path scale X anchor.
 
Path scale Y anchor.
 
Path X scale.
 
Path Y scale.
 
Path translation anchor X.
 
Path translation anchor Y.
 
Path translation X.
 
Path translation Y.
 
Spare calculation matrix.
 
Path bounding box width.
Fields borrowed from class CAAT.PathUtil.PathSegment:
bbox, color, length, parent
Method Summary
Method Attributes Method Name and Description
<private>  
<private>  
 
addArcTo(x1, y1, x2, y2, radius, cw, color)
 
addBehavior(behavior)
Add a Behavior to the Actor.
 
addCatmullTo(px1, py1, px2, py2, px3, py3, color)
Add a Catmull-Rom segment to this path.
 
addCubicTo(px1, py1, px2, py2, px3, py3, color)
Add a Cubic Bezier segment to this path.
 
addLineTo(px1, py1, color)
Adds a line segment to this path.
 
addQuadricTo(px1, py1, px2, py2, color)
Add a Quadric Bezier path segment to this path.
 
addRectangleTo(x1, y1, cw, color)
 
addSegment(pathSegment)
Add a CAAT.PathSegment instance to this path.
 
applyAsPath(director)
Apply this path as a Canvas context path.
 
 
beginPath(px0, py0)
Set the path's starting point.
 
Close the path by adding a line path segment from the current last path coordinate to startCurvePosition coordinate.
 
drag(x, y, callback)
Drags a path's control point.
 
Removes all behaviors from an Actor.
 
Return the last point of the last path segment of this compound path.
 
Finishes the process of building the path.
 
 
flatten(npatches, closed)
 
getContour(iSize)
Returns a collection of CAAT.Point objects which conform a path's contour.
 
 
Return the last path segment added to this path.
 
 
 
Returns an integer with the number of path segments that conform this path.
 
getPosition(time, open_contour)
This method, returns a CAAT.Foundation.Point instance indicating a coordinate in the path.
 
Analogously to the method getPosition, this method returns a CAAT.Point instance with the coordinate on the path that corresponds to the given length.
 
getSegment(index)
Gets a CAAT.PathSegment instance.
 
 
 
paint(director)
Paints the path.
 
press(x, y)
Sent by a CAAT.PathActor instance object to try to drag a path's control point.
 
Method invoked when a CAAT.PathActor stops dragging a control point.
 
Remove a Behavior with id param as behavior identifier from this actor.
 
removeBehaviour(behavior)
Remove a Behavior from the Actor.
 
 
setCatmullRom(points, closed)
 
setCubic(x0, y0, x1, y1, x2, y2, x3, y3)
Sets this path to be composed by a single Cubic Bezier path segment.
 
setInteractive(interactive)
Set whether this path should paint handles for every control point.
 
setLinear(x0, y0, x1, y1)
Set the path to be composed by a single LinearPath segment.
 
 
setPoint(point, index)
Set a point from this path.
 
setPoints(points)
Reposition this path points.
 
 
 
setPositionAnchored(x, y, ax, ay)
 
setQuadric(x0, y0, x1, y1, x2, y2)
Set this path to be composed by a single Quadric Bezier path segment.
 
setRectangle(x0, y0, x1, y1)
 
setRotation(angle)
 
 
setRotationAnchored(angle, rx, ry)
 
setScale(sx, sy)
 
 
setScaleAnchored(scaleX, scaleY, sx, sy)
 
Return the first point of the first path segment of this compound path.
 
updatePath(point, callback)
Indicates that some path control point has changed, and that the path must recalculate its internal data, ie: length and bbox.
Methods borrowed from class CAAT.PathUtil.PathSegment:
drawHandle, getBoundingBox, getLength, setColor, setParent, transform
Class Detail
CAAT.PathUtil.Path()
Field Detail
beginPathX
starting path x position

beginPathY
starting path y position

behaviorList
A list of behaviors to apply to this path. A path can be affine transformed to create a different path.

clipOffsetX
Path bounding box X position.

clipOffsetY
Path bounding box Y position.

closed
Is this path closed ?

height
Path bounding box height.

interactive
Is this path interactive ?. If so, controls points can be moved with a CAAT.Foundation.UI.PathActor.

matrix
Path behaviors matrix.

newPosition
spare CAAT.Math.Point to return calculated values in the path.

pathLength
path length (sum of every segment length)

pathPoints
Original Path´s path segments points.

pathSegmentDurationTime
For each path segment in this path, the normalized calculated duration. precomputed segment duration relative to segment legnth/path length

pathSegments
A collection of PathSegments.

pathSegmentStartTime
For each path segment in this path, the normalized calculated start time. precomputed segment start time relative to segment legnth/path length and duration.

rb_angle
Path rotation angle.

rb_rotateAnchorX
Path rotation x anchor.

rb_rotateAnchorY
Path rotation x anchor.

sb_scaleAnchorX
Path scale X anchor.

sb_scaleAnchorY
Path scale Y anchor.

sb_scaleX
Path X scale.

sb_scaleY
Path Y scale.

tAnchorX
Path translation anchor X.

tAnchorY
Path translation anchor Y.

tb_x
Path translation X.

tb_y
Path translation Y.

tmpMatrix
Spare calculation matrix.

width
Path bounding box width.
Method Detail
<private> __getPositionImpl(time)
Parameters:
time

<private> __init()

addArcTo(x1, y1, x2, y2, radius, cw, color)
Parameters:
x1
y1
x2
y2
radius
cw
color

addBehavior(behavior)
Add a Behavior to the Actor. An Actor accepts an undefined number of Behaviors.
Parameters:
behavior
{CAAT.Behavior} a CAAT.Behavior instance
Returns:
this

addCatmullTo(px1, py1, px2, py2, px3, py3, color)
Add a Catmull-Rom segment to this path. The segment starts in the current last path coordinate.
Parameters:
px1
{number}
py1
{number}
px2
{number}
py2
{number}
px3
{number}
py3
{number}
color
{color=}. optional parameter. determines the color to draw the segment with (if being drawn by a CAAT.PathActor).
Returns:
this

addCubicTo(px1, py1, px2, py2, px3, py3, color)
Add a Cubic Bezier segment to this path. The segment starts in the current last path coordinate.
Parameters:
px1
{number}
py1
{number}
px2
{number}
py2
{number}
px3
{number}
py3
{number}
color
{color=}. optional parameter. determines the color to draw the segment with (if being drawn by a CAAT.PathActor).
Returns:
this

addLineTo(px1, py1, color)
Adds a line segment to this path. The segment starts in the current last path coordinate.
Parameters:
px1
{number}
py1
{number}
color
{color=}. optional parameter. determines the color to draw the segment with (if being drawn by a CAAT.PathActor).
Returns:
this

addQuadricTo(px1, py1, px2, py2, color)
Add a Quadric Bezier path segment to this path. The segment starts in the current last path coordinate.
Parameters:
px1
{number}
py1
{number}
px2
{number}
py2
{number}
color
{color=}. optional parameter. determines the color to draw the segment with (if being drawn by a CAAT.PathActor).
Returns:
this

addRectangleTo(x1, y1, cw, color)
Parameters:
x1
y1
cw
color

addSegment(pathSegment)
Add a CAAT.PathSegment instance to this path.
Parameters:
pathSegment
{CAAT.PathSegment}
Returns:
this

{*} applyAsPath(director)
Apply this path as a Canvas context path. You must explicitly call context.beginPath
Parameters:
director
Returns:
{*}

applyBehaviors(time)
Parameters:
time

beginPath(px0, py0)
Set the path's starting point. The method startCurvePosition will return this coordinate.

If a call to any method of the form addTo is called before this calling this method, they will assume to start at -1,-1 and probably you'll get the wrong path.

Parameters:
px0
{number}
py0
{number}
Returns:
this

closePath()
Close the path by adding a line path segment from the current last path coordinate to startCurvePosition coordinate.

This method closes a path by setting its last path segment's last control point to be the first path segment's first control point.

This method also sets the path as finished, and calculates all path's information such as length and bounding box.

Returns:
this

drag(x, y, callback)
Drags a path's control point. If the method press has not set needed internal data to drag a control point, this method will do nothing, regardless the user is dragging on the CAAT.PathActor delegate.
Parameters:
x
{number}
y
{number}
callback

emptyBehaviorList()
Removes all behaviors from an Actor.
Returns:
this

{CAAT.Point} endCurvePosition()
Return the last point of the last path segment of this compound path.
Returns:
{CAAT.Point}

endPath()
Finishes the process of building the path. It involves calculating each path segments length and proportional length related to a normalized path length of 1. It also sets current paths length. These calculi are needed to traverse the path appropriately.

This method must be called explicitly, except when closing a path (that is, calling the method closePath) which calls this method as well.

Returns:
this

extractPathPoints()

flatten(npatches, closed)
Parameters:
npatches
closed

{[CAAT.Point]} getContour(iSize)
Returns a collection of CAAT.Point objects which conform a path's contour.
Parameters:
iSize
{number}. Number of samples for each path segment.
Returns:
{[CAAT.Point]}

getControlPoint(index)
Parameters:
index

{CAAT.PathSegment} getCurrentPathSegment()
Return the last path segment added to this path.
Returns:
{CAAT.PathSegment}

getFirstPathSegment()

getLastPathSegment()

{number} getNumSegments()
Returns an integer with the number of path segments that conform this path.
Returns:
{number}

{CAAT.Foundation.Point} getPosition(time, open_contour)
This method, returns a CAAT.Foundation.Point instance indicating a coordinate in the path. The returned coordinate is the corresponding to normalizing the path's length to 1, and then finding what path segment and what coordinate in that path segment corresponds for the input time parameter.

The parameter time must be a value ranging 0..1. If not constrained to these values, the parameter will be modulus 1, and then, if less than 0, be normalized to 1+time, so that the value always ranges from 0 to 1.

This method is needed when traversing the path throughout a CAAT.Interpolator instance.

Parameters:
time
{number} a value between 0 and 1 both inclusive. 0 will return path's starting coordinate. 1 will return path's end coordinate.
open_contour
{boolean=} treat this path as an open contour. It is intended for open paths, and interpolators which give values above 1. see tutorial 7.1.
Returns:
{CAAT.Foundation.Point}

{CAAT.Point} getPositionFromLength(iLength)
Analogously to the method getPosition, this method returns a CAAT.Point instance with the coordinate on the path that corresponds to the given length. The input length is related to path's length.
Parameters:
iLength
{number} a float with the target length.
Returns:
{CAAT.Point}

getSegment(index)
Gets a CAAT.PathSegment instance.
Parameters:
index
{number} the index of the desired CAAT.PathSegment.
Returns:
CAAT.PathSegment

isEmpty()

numControlPoints()

paint(director)
Paints the path. This method is called by CAAT.PathActor instances. If the path is set as interactive (by default) path segment will draw curve modification handles as well.
Parameters:
director
{CAAT.Director} a CAAT.Director instance.

press(x, y)
Sent by a CAAT.PathActor instance object to try to drag a path's control point.
Parameters:
x
{number}
y
{number}

release()
Method invoked when a CAAT.PathActor stops dragging a control point.

removeBehaviorById(id)
Remove a Behavior with id param as behavior identifier from this actor. This function will remove ALL behavior instances with the given id.
Parameters:
id
{number} an integer. return this;

removeBehaviour(behavior)
Remove a Behavior from the Actor. If the Behavior is not present at the actor behavior collection nothing happends.
Parameters:
behavior
{CAAT.Behavior} a CAAT.Behavior instance.

setATMatrix()

setCatmullRom(points, closed)
Parameters:
points
closed

setCubic(x0, y0, x1, y1, x2, y2, x3, y3)
Sets this path to be composed by a single Cubic Bezier path segment.
Parameters:
x0
{number}
y0
{number}
x1
{number}
y1
{number}
x2
{number}
y2
{number}
x3
{number}
y3
{number}
Returns:
this

setInteractive(interactive)
Set whether this path should paint handles for every control point.
Parameters:
interactive
{boolean}.

setLinear(x0, y0, x1, y1)
Set the path to be composed by a single LinearPath segment.
Parameters:
x0
{number}
y0
{number}
x1
{number}
y1
{number}
Returns:
this

setLocation(x, y)
Parameters:
x
y

setPoint(point, index)
Set a point from this path.
Parameters:
point
{CAAT.Point}
index
{integer} a point index.

setPoints(points)
Reposition this path points. This operation will only take place if the supplied points array equals in size to this path's already set points.
Parameters:
points
{Array}

setPosition(x, y)
Parameters:
x
y

setPositionAnchor(ax, ay)
Parameters:
ax
ay

setPositionAnchored(x, y, ax, ay)
Parameters:
x
y
ax
ay

setQuadric(x0, y0, x1, y1, x2, y2)
Set this path to be composed by a single Quadric Bezier path segment.
Parameters:
x0
{number}
y0
{number}
x1
{number}
y1
{number}
x2
{number}
y2
{number}
Returns:
this

setRectangle(x0, y0, x1, y1)
Parameters:
x0
y0
x1
y1

setRotation(angle)
Parameters:
angle

setRotationAnchor(ax, ay)
Parameters:
ax
ay

setRotationAnchored(angle, rx, ry)
Parameters:
angle
rx
ry

setScale(sx, sy)
Parameters:
sx
sy

setScaleAnchor(ax, ay)
Parameters:
ax
ay

setScaleAnchored(scaleX, scaleY, sx, sy)
Parameters:
scaleX
scaleY
sx
sy

{CAAT.Point} startCurvePosition()
Return the first point of the first path segment of this compound path.
Returns:
{CAAT.Point}

updatePath(point, callback)
Indicates that some path control point has changed, and that the path must recalculate its internal data, ie: length and bbox.
Parameters:
point
callback

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 01 2013 04:59:20 GMT-0700 (PDT)